[
  {
    "path": ".gitignore",
    "content": "*.VC.db\n*.bin\n*.dcu\n*.ddp\n*.dll\n*.dylib\n*.exe\n*.local.*\n*.o\n*.old\n*.opendb\n*.opensdf\n*.sdf\n*.so\n*.suo\n*.user\n*.~*\n*__pycache__*\n*_old_*\n/.vs\n/DynamicAudioNormalizerGUI/tmp\n/DynamicAudioNormalizerJNI/.settings\n/DynamicAudioNormalizerJNI/bin\n/DynamicAudioNormalizerJNI/out\n/DynamicAudioNormalizerNET/samples/bin\n/DynamicAudioNormalizerNET/samples/obj\n/bin\n/doc\n/etc/vst_sdk/pluginterfaces\n/etc/vst_sdk/public.sdk\n/ipch\n/obj\n/out\n/tmp\n"
  },
  {
    "path": "DynamicAudioNormalizerAPI/DynamicAudioNormalizerAPI_VS2013.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"12.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"Debug|Win32\">\n      <Configuration>Debug</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Debug|x64\">\n      <Configuration>Debug</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|Win32\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|x64\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|Win32\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|x64\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\Binding_JNI.cpp\" />\n    <ClCompile Include=\"src\\DLLMain.cpp\" />\n    <ClCompile Include=\"src\\DynamicAudioNormalizer.cpp\" />\n    <ClCompile Include=\"src\\Test_API.c\" />\n    <ClCompile Include=\"src\\Binding_C.cpp\" />\n    <ClCompile Include=\"src\\FrameBuffer.cpp\" />\n    <ClCompile Include=\"src\\GaussianFilter.cpp\" />\n    <ClCompile Include=\"src\\Logging.cpp\" />\n    <ClCompile Include=\"src\\Version.cpp\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"include\\DynamicAudioNormalizer.h\" />\n    <ClInclude Include=\"src\\FrameBuffer.h\" />\n    <ClInclude Include=\"src\\GaussianFilter.h\" />\n    <ClInclude Include=\"src\\Logging.h\" />\n    <ClInclude Include=\"src\\Version.h\" />\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <ProjectGuid>{376386EE-8268-47E3-A335-7663716E4C60}</ProjectGuid>\n    <Keyword>Win32Proj</Keyword>\n    <RootNamespace>DynamicAudioNormalizerAPI</RootNamespace>\n    <ProjectName>DynamicAudioNormalizerAPI</ProjectName>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>StaticLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\" Label=\"Configuration\">\n    <ConfigurationType>StaticLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <LinkIncremental>true</LinkIncremental>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <LinkIncremental>true</LinkIncremental>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <ClCompile>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(ProjectDir)\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerJNI\\include;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\include;$(JAVA_HOME)\\include;$(JAVA_HOME)\\include\\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <InlineFunctionExpansion>Disabled</InlineFunctionExpansion>\n      <OmitFramePointers>false</OmitFramePointers>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n      <ExceptionHandling>Sync</ExceptionHandling>\n      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\n      <EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <ClCompile>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(ProjectDir)\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerJNI\\include;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\include;$(JAVA_HOME)\\include;$(JAVA_HOME)\\include\\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <InlineFunctionExpansion>Disabled</InlineFunctionExpansion>\n      <OmitFramePointers>false</OmitFramePointers>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n      <ExceptionHandling>Sync</ExceptionHandling>\n      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <AdditionalIncludeDirectories>$(ProjectDir)\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerJNI\\include;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\include;$(JAVA_HOME)\\include;$(JAVA_HOME)\\include\\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <ShowProgress Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">LinkVerboseLib</ShowProgress>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <AdditionalIncludeDirectories>$(ProjectDir)\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerJNI\\include;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\include;$(JAVA_HOME)\\include;$(JAVA_HOME)\\include\\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <ShowProgress Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">LinkVerboseLib</ShowProgress>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <AdditionalIncludeDirectories>$(ProjectDir)\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerJNI\\include;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\include;$(JAVA_HOME)\\include;$(JAVA_HOME)\\include\\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\etc\\vld\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n    </Link>\n    <Lib>\n      <Verbose>true</Verbose>\n    </Lib>\n    <ProjectReference />\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <AdditionalIncludeDirectories>$(ProjectDir)\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerJNI\\include;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\include;$(JAVA_HOME)\\include;$(JAVA_HOME)\\include\\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\etc\\vld\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n    </Link>\n    <Lib>\n      <Verbose>true</Verbose>\n    </Lib>\n    <ProjectReference />\n  </ItemDefinitionGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerAPI/DynamicAudioNormalizerAPI_VS2013.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n    <Filter Include=\"Internal Header Files\">\n      <UniqueIdentifier>{eec3c662-ede0-4758-ba9f-e053d0324afa}</UniqueIdentifier>\n    </Filter>\n    <Filter Include=\"Public Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\DLLMain.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\GaussianFilter.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\Version.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\DynamicAudioNormalizer.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\FrameBuffer.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\Logging.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\Test_API.c\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\Binding_C.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\Binding_JNI.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"src\\GaussianFilter.h\">\n      <Filter>Internal Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\Version.h\">\n      <Filter>Internal Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"include\\DynamicAudioNormalizer.h\">\n      <Filter>Public Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\FrameBuffer.h\">\n      <Filter>Internal Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\Logging.h\">\n      <Filter>Internal Header Files</Filter>\n    </ClInclude>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerAPI/DynamicAudioNormalizerAPI_VS2015.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"14.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"Debug|Win32\">\n      <Configuration>Debug</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Debug|x64\">\n      <Configuration>Debug</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|Win32\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|x64\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|Win32\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|x64\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\Binding_JNI.cpp\" />\n    <ClCompile Include=\"src\\DLLMain.cpp\" />\n    <ClCompile Include=\"src\\DynamicAudioNormalizer.cpp\" />\n    <ClCompile Include=\"src\\Test_API.c\" />\n    <ClCompile Include=\"src\\Binding_C.cpp\" />\n    <ClCompile Include=\"src\\FrameBuffer.cpp\" />\n    <ClCompile Include=\"src\\GaussianFilter.cpp\" />\n    <ClCompile Include=\"src\\Logging.cpp\" />\n    <ClCompile Include=\"src\\Version.cpp\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"include\\DynamicAudioNormalizer.h\" />\n    <ClInclude Include=\"src\\FrameBuffer.h\" />\n    <ClInclude Include=\"src\\GaussianFilter.h\" />\n    <ClInclude Include=\"src\\Logging.h\" />\n    <ClInclude Include=\"src\\Version.h\" />\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <ProjectGuid>{376386EE-8268-47E3-A335-7663716E4C60}</ProjectGuid>\n    <Keyword>Win32Proj</Keyword>\n    <RootNamespace>DynamicAudioNormalizerAPI</RootNamespace>\n    <ProjectName>DynamicAudioNormalizerAPI</ProjectName>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>StaticLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\" Label=\"Configuration\">\n    <ConfigurationType>StaticLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <LinkIncremental>true</LinkIncremental>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <LinkIncremental>true</LinkIncremental>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <ClCompile>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(ProjectDir)\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerJNI\\include;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\include;$(JAVA_HOME)\\include;$(JAVA_HOME)\\include\\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <InlineFunctionExpansion>Disabled</InlineFunctionExpansion>\n      <OmitFramePointers>false</OmitFramePointers>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n      <ExceptionHandling>Sync</ExceptionHandling>\n      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\n      <EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <ClCompile>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(ProjectDir)\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerJNI\\include;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\include;$(JAVA_HOME)\\include;$(JAVA_HOME)\\include\\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <InlineFunctionExpansion>Disabled</InlineFunctionExpansion>\n      <OmitFramePointers>false</OmitFramePointers>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n      <ExceptionHandling>Sync</ExceptionHandling>\n      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <AdditionalIncludeDirectories>$(ProjectDir)\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerJNI\\include;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\include;$(JAVA_HOME)\\include;$(JAVA_HOME)\\include\\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <ShowProgress Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">LinkVerboseLib</ShowProgress>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <AdditionalIncludeDirectories>$(ProjectDir)\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerJNI\\include;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\include;$(JAVA_HOME)\\include;$(JAVA_HOME)\\include\\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <ShowProgress Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">LinkVerboseLib</ShowProgress>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <AdditionalIncludeDirectories>$(ProjectDir)\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerJNI\\include;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\include;$(JAVA_HOME)\\include;$(JAVA_HOME)\\include\\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\etc\\vld\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n    </Link>\n    <Lib>\n      <Verbose>true</Verbose>\n    </Lib>\n    <ProjectReference />\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <AdditionalIncludeDirectories>$(ProjectDir)\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerJNI\\include;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\include;$(JAVA_HOME)\\include;$(JAVA_HOME)\\include\\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\etc\\vld\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n    </Link>\n    <Lib>\n      <Verbose>true</Verbose>\n    </Lib>\n    <ProjectReference />\n  </ItemDefinitionGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerAPI/DynamicAudioNormalizerAPI_VS2015.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n    <Filter Include=\"Internal Header Files\">\n      <UniqueIdentifier>{eec3c662-ede0-4758-ba9f-e053d0324afa}</UniqueIdentifier>\n    </Filter>\n    <Filter Include=\"Public Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\DLLMain.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\GaussianFilter.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\Version.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\DynamicAudioNormalizer.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\FrameBuffer.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\Logging.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\Test_API.c\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\Binding_C.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\Binding_JNI.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"src\\GaussianFilter.h\">\n      <Filter>Internal Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\Version.h\">\n      <Filter>Internal Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"include\\DynamicAudioNormalizer.h\">\n      <Filter>Public Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\FrameBuffer.h\">\n      <Filter>Internal Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\Logging.h\">\n      <Filter>Internal Header Files</Filter>\n    </ClInclude>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerAPI/DynamicAudioNormalizerAPI_VS2017.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"14.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"Debug|Win32\">\n      <Configuration>Debug</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Debug|x64\">\n      <Configuration>Debug</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|Win32\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|x64\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|Win32\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|x64\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\Binding_JNI.cpp\" />\n    <ClCompile Include=\"src\\DLLMain.cpp\" />\n    <ClCompile Include=\"src\\DynamicAudioNormalizer.cpp\" />\n    <ClCompile Include=\"src\\Test_API.c\" />\n    <ClCompile Include=\"src\\Binding_C.cpp\" />\n    <ClCompile Include=\"src\\FrameBuffer.cpp\" />\n    <ClCompile Include=\"src\\GaussianFilter.cpp\" />\n    <ClCompile Include=\"src\\Logging.cpp\" />\n    <ClCompile Include=\"src\\Version.cpp\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"include\\DynamicAudioNormalizer.h\" />\n    <ClInclude Include=\"src\\FrameBuffer.h\" />\n    <ClInclude Include=\"src\\GaussianFilter.h\" />\n    <ClInclude Include=\"src\\Logging.h\" />\n    <ClInclude Include=\"src\\Version.h\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"res\\DynamicAudioNormalizerAPI.rc\">\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">true</ExcludedFromBuild>\n      <ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\">true</ExcludedFromBuild>\n    </ResourceCompile>\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <ProjectGuid>{376386EE-8268-47E3-A335-7663716E4C60}</ProjectGuid>\n    <Keyword>Win32Proj</Keyword>\n    <RootNamespace>DynamicAudioNormalizerAPI</RootNamespace>\n    <ProjectName>DynamicAudioNormalizerAPI</ProjectName>\n    <WindowsTargetPlatformVersion>7.0</WindowsTargetPlatformVersion>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>StaticLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\" Label=\"Configuration\">\n    <ConfigurationType>StaticLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <LinkIncremental>true</LinkIncremental>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <LinkIncremental>true</LinkIncremental>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <ClCompile>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(ProjectDir)\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerJNI\\include;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\include;$(JAVA_HOME)\\include;$(JAVA_HOME)\\include\\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <InlineFunctionExpansion>Disabled</InlineFunctionExpansion>\n      <OmitFramePointers>false</OmitFramePointers>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n      <ExceptionHandling>Sync</ExceptionHandling>\n      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\n      <EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <ClCompile>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(ProjectDir)\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerJNI\\include;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\include;$(JAVA_HOME)\\include;$(JAVA_HOME)\\include\\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <InlineFunctionExpansion>Disabled</InlineFunctionExpansion>\n      <OmitFramePointers>false</OmitFramePointers>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n      <ExceptionHandling>Sync</ExceptionHandling>\n      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <AdditionalIncludeDirectories>$(ProjectDir)\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerJNI\\include;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\include;$(JAVA_HOME)\\include;$(JAVA_HOME)\\include\\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <ShowProgress Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">LinkVerboseLib</ShowProgress>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n    </Link>\n    <Manifest>\n      <AdditionalManifestFiles>$(SolutionDir)DynamicAudioNormalizerShared\\res\\compat.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>\n    </Manifest>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <AdditionalIncludeDirectories>$(ProjectDir)\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerJNI\\include;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\include;$(JAVA_HOME)\\include;$(JAVA_HOME)\\include\\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <ShowProgress Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">LinkVerboseLib</ShowProgress>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n    </Link>\n    <Manifest>\n      <AdditionalManifestFiles>$(SolutionDir)DynamicAudioNormalizerShared\\res\\compat.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>\n    </Manifest>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <AdditionalIncludeDirectories>$(ProjectDir)\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerJNI\\include;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\include;$(JAVA_HOME)\\include;$(JAVA_HOME)\\include\\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\etc\\vld\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n    </Link>\n    <Lib>\n      <Verbose>true</Verbose>\n    </Lib>\n    <ProjectReference />\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <AdditionalIncludeDirectories>$(ProjectDir)\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerJNI\\include;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\include;$(JAVA_HOME)\\include;$(JAVA_HOME)\\include\\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\etc\\vld\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n    </Link>\n    <Lib>\n      <Verbose>true</Verbose>\n    </Lib>\n    <ProjectReference />\n  </ItemDefinitionGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerAPI/DynamicAudioNormalizerAPI_VS2017.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n    <Filter Include=\"Internal Header Files\">\n      <UniqueIdentifier>{eec3c662-ede0-4758-ba9f-e053d0324afa}</UniqueIdentifier>\n    </Filter>\n    <Filter Include=\"Public Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\DLLMain.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\GaussianFilter.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\Version.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\DynamicAudioNormalizer.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\FrameBuffer.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\Logging.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\Test_API.c\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\Binding_C.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\Binding_JNI.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"src\\GaussianFilter.h\">\n      <Filter>Internal Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\Version.h\">\n      <Filter>Internal Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"include\\DynamicAudioNormalizer.h\">\n      <Filter>Public Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\FrameBuffer.h\">\n      <Filter>Internal Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\Logging.h\">\n      <Filter>Internal Header Files</Filter>\n    </ClInclude>\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"res\\DynamicAudioNormalizerAPI.rc\">\n      <Filter>Resource Files</Filter>\n    </ResourceCompile>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerAPI/include/DynamicAudioNormalizer.h",
    "content": "/* ================================================================================== */\n/* Dynamic Audio Normalizer - Audio Processing Library                                */\n/* Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.             */\n/*                                                                                    */\n/* This library is free software; you can redistribute it and/or                      */\n/* modify it under the terms of the GNU Lesser General Public                         */\n/* License as published by the Free Software Foundation; either                       */\n/* version 2.1 of the License, or (at your option) any later version.                 */\n/*                                                                                    */\n/* This library is distributed in the hope that it will be useful,                    */\n/* but WITHOUT ANY WARRANTY; without even the implied warranty of                     */\n/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                  */\n/* Lesser General Public License for more details.                                    */\n/*                                                                                    */\n/* You should have received a copy of the GNU Lesser General Public                   */\n/* License along with this library; if not, write to the Free Software                */\n/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA     */\n/*                                                                                    */\n/* http://www.gnu.org/licenses/lgpl-2.1.txt                                           */\n/* ================================================================================== */\n\n#pragma once\n\n/*StdLib includes*/\n#ifndef __STDC_LIMIT_MACROS\n#define __STDC_LIMIT_MACROS\n#endif\n#include <stdint.h>\n\n/*DLL Export Definitions*/\n#ifdef _MSC_VER\n#  ifdef MDYNAMICAUDIONORMALIZER_EXPORTS\n#    pragma message(\"MDynamicAudioNormalizer DLL: Export\")\n#    define MDYNAMICAUDIONORMALIZER_DLL __declspec(dllexport)\n#  else\n#    ifndef MDYNAMICAUDIONORMALIZER_STATIC\n#      pragma message(\"MDynamicAudioNormalizer DLL: Import\")\n#      define MDYNAMICAUDIONORMALIZER_DLL __declspec(dllimport)\n#    else\n#      define MDYNAMICAUDIONORMALIZER_DLL\n#    endif\n#  endif\n#else\n#  ifdef __GNUC__\n#    ifdef MDYNAMICAUDIONORMALIZER_EXPORTS\n#      define MDYNAMICAUDIONORMALIZER_DLL __attribute__ ((visibility (\"default\")))\n#    else\n#      define MDYNAMICAUDIONORMALIZER_DLL\n#    endif\n#  else\n#    define MDYNAMICAUDIONORMALIZER_DLL\n#  endif\n#endif\n\n/*Utility macros*/\n#define MDYNAMICAUDIONORMALIZER_GLUE1(X,Y) X##Y\n#define MDYNAMICAUDIONORMALIZER_GLUE2(X,Y) MDYNAMICAUDIONORMALIZER_GLUE1(X,Y)\n\n/*Interface version*/\n#define MDYNAMICAUDIONORMALIZER_CORE 8\n#define MDYNAMICAUDIONORMALIZER_FUNCTION(X) MDYNAMICAUDIONORMALIZER_GLUE2(MDynamicAudioNormalizer_##X##_r, MDYNAMICAUDIONORMALIZER_CORE)\n#define MDynamicAudioNormalizer MDYNAMICAUDIONORMALIZER_GLUE2(MDynamicAudioNormalizer_r,MDYNAMICAUDIONORMALIZER_CORE)\n\n/*Callback for log messages*/\ntypedef void (MDYNAMICAUDIONORMALIZER_FUNCTION(LogFunction))(const int logLevel, const char *const message);\n\n/* ================================================================================== */\n/* API for C++ application                                                            */\n/* ================================================================================== */\n\n#ifdef __cplusplus /*C++ compiler!*/\n\n/*Standard Library include*/\n#include <cstdio>\n\n/*Opaque Data Class*/\nclass MDynamicAudioNormalizer_PrivateData;\n\n/*Dynamic Normalizer Class*/\nclass MDYNAMICAUDIONORMALIZER_DLL MDynamicAudioNormalizer\n{\npublic:\n\t/*Constructor & Destructor*/\n\tMDynamicAudioNormalizer(const uint32_t channels, const uint32_t sampleRate, const uint32_t frameLenMsec = 500, const uint32_t filterSize = 31, const double peakValue = 0.95, const double maxAmplification = 10.0, const double targetRms = 0.0, const double compressFactor = 0.0, const bool channelsCoupled = true, const bool enableDCCorrection = false, const bool altBoundaryMode = false, FILE *const logFile = NULL);\n\tvirtual ~MDynamicAudioNormalizer(void);\n\t\n\t/*Public API*/\n\tbool initialize(void);\n\tbool process(const double *const *const samplesIn, double *const *const samplesOut, const int64_t inputSize, int64_t &outputSize);\n\tbool processInplace(double *const *const samplesInOut, const int64_t inputSize, int64_t &outputSize);\n\tbool flushBuffer(double *const *const samplesOut, const int64_t bufferSize, int64_t &outputSize);\n\tbool reset(void);\n\tbool getConfiguration(uint32_t &channels, uint32_t &sampleRate, uint32_t &frameLen, uint32_t &filterSize);\n\tbool getInternalDelay(int64_t &delayInSamples);\n\n\t/*Type definitions*/\n\ttypedef MDYNAMICAUDIONORMALIZER_FUNCTION(LogFunction) LogFunction;\n\tenum { LOG_LEVEL_DBG = 0, LOG_LEVEL_WRN = 1, LOG_LEVEL_ERR = 2 };\n\n\t/*Static functions*/\n\tstatic void getVersionInfo(uint32_t &major, uint32_t &minor, uint32_t &patch);\n\tstatic void getBuildInfo(const char **const date, const char **const time, const char **const compiler, const char **const arch, bool &debug);\n\tstatic LogFunction *setLogFunction(LogFunction *const logFunction);\n\nprivate:\n\tMDynamicAudioNormalizer(const MDynamicAudioNormalizer&) : p(NULL)  { throw \"unsupported\"; }\n\tMDynamicAudioNormalizer &operator=(const MDynamicAudioNormalizer&) { throw \"unsupported\"; }\n\n\tMDynamicAudioNormalizer_PrivateData *const p;\n};\n\n#endif /*__cplusplus*/\n\n/* ================================================================================== */\n/* API for C applications                                                             */\n/* ================================================================================== */\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif /*__cplusplus*/\n\n/*Standard Library include*/\n#include <stdio.h>\n\n/*Opaque handle*/\ntypedef struct MDynamicAudioNormalizer_Handle MDynamicAudioNormalizer_Handle;\n\n/*Global Functions*/\nMDYNAMICAUDIONORMALIZER_DLL MDynamicAudioNormalizer_Handle* MDYNAMICAUDIONORMALIZER_FUNCTION(createInstance)(const uint32_t channels, const uint32_t sampleRate, const uint32_t frameLenMsec, const uint32_t filterSize, const double peakValue, const double maxAmplification, const double targetRms, const double compressFactor, const int channelsCoupled, const int enableDCCorrection, const int altBoundaryMode, FILE *const logFile);\nMDYNAMICAUDIONORMALIZER_DLL void MDYNAMICAUDIONORMALIZER_FUNCTION(destroyInstance)(MDynamicAudioNormalizer_Handle **const handle);\nMDYNAMICAUDIONORMALIZER_DLL int  MDYNAMICAUDIONORMALIZER_FUNCTION(process)(MDynamicAudioNormalizer_Handle *const handle, const double *const *const samplesIn, double *const *const samplesOut, const int64_t inputSize, int64_t *const outputSize);\nMDYNAMICAUDIONORMALIZER_DLL int  MDYNAMICAUDIONORMALIZER_FUNCTION(processInplace)(MDynamicAudioNormalizer_Handle *const handle, double *const *const samplesInOut, const int64_t inputSize, int64_t *const outputSize);\nMDYNAMICAUDIONORMALIZER_DLL int  MDYNAMICAUDIONORMALIZER_FUNCTION(flushBuffer)(MDynamicAudioNormalizer_Handle *const handle, double *const *const samplesOut, const int64_t bufferSize, int64_t *const outputSize);\nMDYNAMICAUDIONORMALIZER_DLL int  MDYNAMICAUDIONORMALIZER_FUNCTION(reset)(MDynamicAudioNormalizer_Handle *const handle);\nMDYNAMICAUDIONORMALIZER_DLL int  MDYNAMICAUDIONORMALIZER_FUNCTION(getConfiguration)(MDynamicAudioNormalizer_Handle *const handle, uint32_t *const channels, uint32_t *const sampleRate, uint32_t *const frameLen, uint32_t *const filterSize);\nMDYNAMICAUDIONORMALIZER_DLL int  MDYNAMICAUDIONORMALIZER_FUNCTION(getInternalDelay)(MDynamicAudioNormalizer_Handle *const handle, int64_t *const delayInSamples);\nMDYNAMICAUDIONORMALIZER_DLL void MDYNAMICAUDIONORMALIZER_FUNCTION(getVersionInfo)(uint32_t *const major, uint32_t *const minor, uint32_t *const patch);\nMDYNAMICAUDIONORMALIZER_DLL void MDYNAMICAUDIONORMALIZER_FUNCTION(getBuildInfo)(const char **const date, const char **const time, const char **const compiler, const char **const arch, int *const debug);\nMDYNAMICAUDIONORMALIZER_DLL MDYNAMICAUDIONORMALIZER_FUNCTION(LogFunction) *MDYNAMICAUDIONORMALIZER_FUNCTION(setLogFunction)(MDYNAMICAUDIONORMALIZER_FUNCTION(LogFunction) *const logFunction);\n\n#ifdef __cplusplus\n}\n#endif /*__cplusplus*/\n"
  },
  {
    "path": "DynamicAudioNormalizerAPI/makefile",
    "content": "##############################################################################\n# Dynamic Audio Normalizer - Audio Processing Library\n# Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n#\n# This library is free software; you can redistribute it and/or\n# modify it under the terms of the GNU Lesser General Public\n# License as published by the Free Software Foundation; either\n# version 2.1 of the License, or (at your option) any later version.\n#\n# This library is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n# Lesser General Public License for more details.\n#\n# You should have received a copy of the GNU Lesser General Public\n# License along with this library; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n#\n# http://www.gnu.org/licenses/lgpl-2.1.txt\n##############################################################################\n\nECHO=echo -e\nSHELL=/bin/bash\n\nJAVA_HOME ?= $(shell update-java-alternatives -l 2>/dev/null | grep -oE '[^[:space:]]+$$' || echo \"/usr/lib/jvm/default\")\n\n##############################################################################\n# Constants\n##############################################################################\n\nLIBRARY_NAME := libDynamicAudioNormalizerAPI\n\nifndef API_VERSION\n   $(error API_VERSION variable is not set!)\nendif\n\n##############################################################################\n# JDK Checks\n##############################################################################\n\nifneq ($(MAKECMDGOALS),clean)\n   ifneq ($(ENABLE_JNI),false)\n      JDK_CHECK := $(shell [ -f $(JAVA_HOME)/include/jni.h ] && echo true || echo false)\n      ifneq ($(JDK_CHECK),true)\n         $(error File \"include/jni.h\" not found in JAVA_HOME path!)\n      endif\n   endif\nendif\n\n##############################################################################\n# Flags\n##############################################################################\n\nDEBUG_BUILD ?= 0\nMARCH ?= native\n\nifeq ($(DEBUG_BUILD), 1)\n   CONFIG_NAME = Debug\n   CXXFLAGS = -g -O0 -D_DEBUG\nelse\n   CONFIG_NAME = Release\n   CXXFLAGS = -O3 -Wall -ffast-math -mfpmath=sse -msse -fomit-frame-pointer -fno-tree-vectorize -DNDEBUG -march=$(MARCH)\nendif\n\nifneq ($(findstring MINGW,$(shell uname -s)),MINGW)\n   CXXFLAGS += -fPIC\nendif\n\nCXXFLAGS += -std=gnu++11\nCXXFLAGS += -fvisibility=hidden\nCXXFLAGS += -DMDYNAMICAUDIONORMALIZER_EXPORTS\n\nCXXFLAGS += -I./src\nCXXFLAGS += -I./include\nCXXFLAGS += -I../DynamicAudioNormalizerShared/include\nCXXFLAGS += -I../DynamicAudioNormalizerJNI/include\n\nifneq ($(ENABLE_JNI),false)\n   CXXFLAGS += -I$(JAVA_HOME)/include\n   ifeq ($(findstring MINGW,$(shell uname -s)),MINGW)\n      CXXFLAGS += -I$(JAVA_HOME)/include/win32\n   else ifeq ($(shell uname), Darwin)\n      CXXFLAGS += -I$(JAVA_HOME)/include/darwin\n   else\n      CXXFLAGS += -I$(JAVA_HOME)/include/linux\n   endif\nelse\n   CXXFLAGS += -DNO_JAVA_SUPPORT\nendif\n\n##############################################################################\n# File Names\n##############################################################################\n\nifeq ($(findstring MINGW,$(shell uname -s)),MINGW)\n   SO_EXT = dll\n   LDXFLAGS += -Wl,--out-implib,$@.a\n   SHAREDFLAG = -shared\nelse ifeq ($(shell uname), Darwin)\n   SO_EXT = dylib\n   SHAREDFLAG = -dynamiclib\nelse\n   SO_EXT = so\n   SHAREDFLAG = -shared\nendif\n\nSOURCES_CPP = $(wildcard src/*.cpp)\nSOURCES_OBJ = $(patsubst %.cpp,%.o,$(SOURCES_CPP))\n\nLIBRARY_OUT = lib/$(LIBRARY_NAME)-$(API_VERSION)\nLIBRARY_BIN = $(LIBRARY_OUT).$(SO_EXT)\nLIBRARY_DBG = $(LIBRARY_OUT)-DBG.$(SO_EXT)\n\n##############################################################################\n# Rules\n##############################################################################\n\n.PHONY: all clean\n\nall: $(LIBRARY_DBG) $(LIBRARY_BIN)\n\n#-------------------------------------------------------------\n# Link & Strip\n#-------------------------------------------------------------\n\n$(LIBRARY_BIN): $(SOURCES_OBJ)\n\t@$(ECHO) \"\\e[1;36m[STR] $@\\e[0m\"\n\t@mkdir -p $(dir $@)\n\tg++ $(SHAREDFLAG) -g0 -o $@ $+ $(LDXFLAGS)\nifeq ($(shell uname), Darwin)\n\tinstall_name_tool -id \"@loader_path/$(notdir $@)\" $@\n\tstrip -u -r -x $@\nelse\n\tstrip --strip-unneeded $@\nendif\n\n$(LIBRARY_DBG): $(SOURCES_OBJ)\n\t@$(ECHO) \"\\e[1;36m[LNK] $@\\e[0m\"\n\t@mkdir -p $(dir $@)\n\tg++ $(SHAREDFLAG) -o $@ $+ $(LDXFLAGS)\nifeq ($(shell uname), Darwin)\n\tinstall_name_tool -id \"@loader_path/$(notdir $@)\" $@\nendif\n\n#-------------------------------------------------------------\n# Compile\n#-------------------------------------------------------------\n\n%.o: %.cpp\n\t@$(ECHO) \"\\e[1;36m[CXX] $<\\e[0m\"\n\t@mkdir -p $(dir $@)\n\tg++ $(CXXFLAGS) -c $< -o $@\n\n#-------------------------------------------------------------\n# Clean\n#-------------------------------------------------------------\n\nclean:\n\trm -fv $(SOURCES_OBJ)\n\trm -rfv ./lib\n\n"
  },
  {
    "path": "DynamicAudioNormalizerAPI/res/DynamicAudioNormalizerAPI.rc",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Library\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This library is free software; you can redistribute it and/or\n// modify it under the terms of the GNU Lesser General Public\n// License as published by the Free Software Foundation; either\n// version 2.1 of the License, or (at your option) any later version.\n//\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public\n// License along with this library; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n//\n// http://www.gnu.org/licenses/lgpl-2.1.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#include \"WinResrc.h\" //\"afxres.h\"\n\n#define INC_DYNAUDNORM_VERSION_INTERNAL 0x22b4f8a9\n#include \"../DynamicAudioNormalizerShared/res/version.inc\"\n\n//////////////////////////////////////////////////////////////////////////////////\n// Neutral resources\n//////////////////////////////////////////////////////////////////////////////////\n\n#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)\n#ifdef _WIN32\nLANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL\n#pragma code_page(1252)\n#endif //_WIN32\n\n//////////////////////////////////////////////////////////////////////////////////\n// Version\n//////////////////////////////////////////////////////////////////////////////////\n\nVS_VERSION_INFO VERSIONINFO\n FILEVERSION    VER_DYNAUDNORM_MAJOR,VER_DYNAUDNORM_MINOR_HI,VER_DYNAUDNORM_MINOR_LO,VER_DYNAUDNORM_PATCH\n PRODUCTVERSION VER_DYNAUDNORM_MAJOR,VER_DYNAUDNORM_MINOR_HI,VER_DYNAUDNORM_MINOR_LO,VER_DYNAUDNORM_PATCH\n FILEFLAGSMASK 0x17L\n#ifdef _DEBUG\n FILEFLAGS 0x3L\n#else\n FILEFLAGS 0x2L\n#endif\n FILEOS 0x40004L\n FILETYPE 0x2L\n FILESUBTYPE 0x0L\nBEGIN\n    BLOCK \"StringFileInfo\"\n    BEGIN\n        BLOCK \"000004b0\"\n        BEGIN\n            VALUE \"Comments\", \"This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License <http://www.gnu.org/>.\"\n            VALUE \"CompanyName\", \"LoRd_MuldeR <mulder2@gmx.de>\"\n            VALUE \"FileDescription\", \"DynamicAudioNormalizer Core Library\"\n            VALUE \"FileVersion\", VER_DYNAUDNORM_STR\n            VALUE \"InternalName\", \"DynamicAudioNormalizerAPI\"\n            VALUE \"LegalCopyright\", \"Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>\"\n            VALUE \"LegalTrademarks\", \"This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License <http://www.gnu.org/>\"\n            VALUE \"OriginalFilename\", \"DynamicAudioNormalizerAPI.dll\"\n            VALUE \"ProductName\", \"DynamicAudioNormalizer\"\n            VALUE \"ProductVersion\", VER_DYNAUDNORM_STR\n        END\n    END\n    BLOCK \"VarFileInfo\"\n    BEGIN\n        VALUE \"Translation\", 0x0, 1200\n    END\nEND\n\n#endif    // Neutral resources\n"
  },
  {
    "path": "DynamicAudioNormalizerAPI/src/Binding_C.cpp",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Library\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This library is free software; you can redistribute it and/or\n// modify it under the terms of the GNU Lesser General Public\n// License as published by the Free Software Foundation; either\n// version 2.1 of the License, or (at your option) any later version.\n//\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public\n// License along with this library; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n//\n// http://www.gnu.org/licenses/lgpl-2.1.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#include \"DynamicAudioNormalizer.h\"\n\n#define INT2BOOL(X) ((X) != 0)\n\nextern \"C\"\n{\n\tMDynamicAudioNormalizer_Handle* MDYNAMICAUDIONORMALIZER_FUNCTION(createInstance)(const uint32_t channels, const uint32_t sampleRate, const uint32_t frameLenMsec, const uint32_t filterSize, const double peakValue, const double maxAmplification, const double targetRms, const double compressFactor, const int channelsCoupled, const int enableDCCorrection, const int altBoundaryMode, FILE *const logFile)\n\t{\n\t\ttry\n\t\t{\n\t\t\tMDynamicAudioNormalizer *const instance = new MDynamicAudioNormalizer(channels, sampleRate, frameLenMsec, filterSize, peakValue, maxAmplification, targetRms, compressFactor, INT2BOOL(channelsCoupled), INT2BOOL(enableDCCorrection), INT2BOOL(altBoundaryMode), logFile);\n\t\t\tif(instance->initialize())\n\t\t\t{\n\t\t\t\treturn reinterpret_cast<MDynamicAudioNormalizer_Handle*>(instance);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tdelete instance;\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t}\n\t\tcatch(...)\n\t\t{\n\t\t\treturn NULL;\n\t\t}\n\t}\n\n\tMDYNAMICAUDIONORMALIZER_DLL void MDYNAMICAUDIONORMALIZER_FUNCTION(destroyInstance)(MDynamicAudioNormalizer_Handle **const handle)\n\t{\n\t\tif(MDynamicAudioNormalizer **const instance = reinterpret_cast<MDynamicAudioNormalizer**>(handle))\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tdelete (*instance);\n\t\t\t\t(*instance) = NULL;\n\t\t\t}\n\t\t\tcatch(...)\n\t\t\t{\n\t\t\t\t/*ignore exception*/\n\t\t\t}\n\t\t}\n\t}\n\t\n\tint  MDYNAMICAUDIONORMALIZER_FUNCTION(process)(MDynamicAudioNormalizer_Handle *const handle, const double *const *const samplesIn, double *const *const samplesOut, const int64_t inputSize, int64_t *const outputSize)\n\t{\n\t\tif (MDynamicAudioNormalizer *const instance = reinterpret_cast<MDynamicAudioNormalizer*>(handle))\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\treturn instance->process(samplesIn, samplesOut, inputSize, (*outputSize)) ? 1 : 0;\n\t\t\t}\n\t\t\tcatch (...)\n\t\t\t{\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n\n\tint MDYNAMICAUDIONORMALIZER_FUNCTION(processInplace)(MDynamicAudioNormalizer_Handle *const handle, double *const *const samplesInOut, const int64_t inputSize, int64_t *const outputSize)\n\t{\n\t\tif(MDynamicAudioNormalizer *const instance = reinterpret_cast<MDynamicAudioNormalizer*>(handle))\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\treturn instance->processInplace(samplesInOut, inputSize, (*outputSize)) ? 1 : 0;\n\t\t\t}\n\t\t\tcatch(...)\n\t\t\t{\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n\n\tint  MDYNAMICAUDIONORMALIZER_FUNCTION(flushBuffer)(MDynamicAudioNormalizer_Handle *const handle, double *const *const samplesOut, const int64_t bufferSize, int64_t *const outputSize)\n\t{\n\t\tif(MDynamicAudioNormalizer *const instance = reinterpret_cast<MDynamicAudioNormalizer*>(handle))\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\treturn instance->flushBuffer(samplesOut, bufferSize, (*outputSize)) ? 1 : 0;\n\t\t\t}\n\t\t\tcatch(...)\n\t\t\t{\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n\n\tint MDYNAMICAUDIONORMALIZER_FUNCTION(reset)(MDynamicAudioNormalizer_Handle *const handle)\n\t{\n\t\tif(MDynamicAudioNormalizer *instance = reinterpret_cast<MDynamicAudioNormalizer*>(handle))\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\treturn instance->reset() ? 1 : 0;\n\t\t\t}\n\t\t\tcatch(...)\n\t\t\t{\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n\n\tint MDYNAMICAUDIONORMALIZER_FUNCTION(getConfiguration)(MDynamicAudioNormalizer_Handle *const handle, uint32_t *const channels, uint32_t *const sampleRate, uint32_t *const frameLen, uint32_t *const filterSize)\n\t{\n\t\tif(MDynamicAudioNormalizer *const instance = reinterpret_cast<MDynamicAudioNormalizer*>(handle))\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\treturn instance->getConfiguration((*channels), (*sampleRate), (*frameLen), (*filterSize)) ? 1 : 0;\n\t\t\t}\n\t\t\tcatch(...)\n\t\t\t{\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n\n\tint MDYNAMICAUDIONORMALIZER_FUNCTION(getInternalDelay)(MDynamicAudioNormalizer_Handle *const handle, int64_t *const delayInSamples)\n\t{\n\t\tif(MDynamicAudioNormalizer *const instance = reinterpret_cast<MDynamicAudioNormalizer*>(handle))\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\treturn instance->getInternalDelay(*delayInSamples) ? 1 : 0;\n\t\t\t}\n\t\t\tcatch(...)\n\t\t\t{\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n\n\tMDYNAMICAUDIONORMALIZER_FUNCTION(LogFunction) *MDYNAMICAUDIONORMALIZER_FUNCTION(setLogFunction)(MDYNAMICAUDIONORMALIZER_FUNCTION(LogFunction) *const logFunction)\n\t{\n\t\treturn MDynamicAudioNormalizer::setLogFunction(logFunction);\n\t}\n\n\tvoid MDYNAMICAUDIONORMALIZER_FUNCTION(getVersionInfo)(uint32_t *const major, uint32_t *const minor, uint32_t *const patch)\n\t{\n\t\tMDynamicAudioNormalizer::getVersionInfo((*major), (*minor), (*patch));\n\t}\n\n\tvoid MDYNAMICAUDIONORMALIZER_FUNCTION(getBuildInfo)(const char **const date, const char **const time, const char **const compiler, const char **const arch, int *const debug)\n\t{\n\t\tbool isDebug;\n\t\tMDynamicAudioNormalizer::getBuildInfo(date, time, compiler, arch, isDebug);\n\t\t*debug = isDebug ? 1 : 0;\n\t}\n}\n"
  },
  {
    "path": "DynamicAudioNormalizerAPI/src/Binding_JNI.cpp",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Library\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This library is free software; you can redistribute it and/or\n// modify it under the terms of the GNU Lesser General Public\n// License as published by the Free Software Foundation; either\n// version 2.1 of the License, or (at your option) any later version.\n//\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public\n// License along with this library; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n//\n// http://www.gnu.org/licenses/lgpl-2.1.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#include \"DynamicAudioNormalizer.h\"\n\n//Java support?\n#ifndef NO_JAVA_SUPPORT\n\n//StdLib\n#include <algorithm>\n#include <stdexcept>\n#include <queue>\n#include <climits>\n\n#ifdef __APPLE__\n#include <stdlib.h>\n#else\n#include <malloc.h>\n#endif //__APPLE__\n\n//C++11 support\n#if (__cplusplus >= 201100L) || (defined(_MSC_VER) && (_MSC_VER > 1600))\n#include <unordered_map>\n#define MAP_TYPE std::unordered_map\n#else\n#pragma message \"C++11 support *not* enabled\"\n#include <map>\n#define MAP_TYPE std::map\n#endif\n\n//Generate the JNI header file name\n#define JAVA_HDRNAME_GLUE1(X,Y) <X##_r##Y.h>\n#define JAVA_HDRNAME_GLUE2(X,Y) JAVA_HDRNAME_GLUE1(X,Y)\n#define JAVA_HDRNAME(X) JAVA_HDRNAME_GLUE2(X, MDYNAMICAUDIONORMALIZER_CORE)\n\n//Generate JNI export names and corresponding helper functions\n#define JAVA_FUNCTION_GLUE1(X,Y,Z) X##Y##_##Z\n#define JAVA_FUNCTION_GLUE2(X,Y,Z) JAVA_FUNCTION_GLUE1(X,Y,Z)\n#define JAVA_FUNCTION(X) JAVA_FUNCTION_GLUE2(Java_com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_00024NativeAPI_1r, MDYNAMICAUDIONORMALIZER_CORE, X)\n#define JAVA_FUNCIMPL(X) JAVA_FUNCTION_GLUE2(Impl_com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_00024NativeAPI_1r, MDYNAMICAUDIONORMALIZER_CORE, X)\n\n//JNI Headers\n#include JAVA_HDRNAME(com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_NativeAPI)\n\n//Internal\n#include <Common.h>\n#include <Threads.h>\n\n//Globals\nstatic MY_CRITSEC_INIT(g_javaLock);\n\n///////////////////////////////////////////////////////////////////////////////\n// Utility Functions\n///////////////////////////////////////////////////////////////////////////////\n\n#define JAVA_FIND_CLASS(VAR,NAME,RET) do \\\n{ \\\n\t(VAR) = env->FindClass((NAME)); \\\n\tif((VAR) == NULL) \\\n\t{ \\\n\t\treturn (RET); \\\n\t} \\\n} \\\nwhile(0)\n\n#define JAVA_GET_METHOD(VAR,CLASS,NAME,ARGS,RET) do \\\n{ \\\n\t(VAR) = env->GetMethodID((CLASS), (NAME), (ARGS)); \\\n\tif((VAR) == NULL) \\\n\t{ \\\n\t\treturn (RET); \\\n\t} \\\n} \\\nwhile(0)\n\n#define JAVA_GET_METHOD_STATIC(VAR,CLASS,NAME,ARGS,RET) do \\\n{ \\\n\t(VAR) = env->GetStaticMethodID((CLASS), (NAME), (ARGS)); \\\n\tif((VAR) == NULL) \\\n\t{ \\\n\t\treturn (RET); \\\n\t} \\\n} \\\nwhile(0)\n\n#define JAVA_MAP_PUT_STRING(MAP,KEY,VAL) do \\\n{ \\\n\tjstring _key = env->NewStringUTF((KEY)); \\\n\tjstring _val = env->NewStringUTF((VAL)); \\\n\t\\\n\tif(_key && _val) \\\n\t{ \\\n\t\tjobject _ret = env->CallObjectMethod((MAP), putMethod, _key, _val); \\\n\t\tif(_ret) env->DeleteLocalRef(_ret); \\\n\t} \\\n\t\\\n\tif(_key) env->DeleteLocalRef(_key); \\\n\tif(_val) env->DeleteLocalRef(_val); \\\n} \\\nwhile(0)\n\n#define JAVA_MAP_PUT_INTEGER(MAP,KEY,VAL) do \\\n{ \\\n\tjstring _key = env->NewStringUTF((KEY)); \\\n\tjobject _val = javaNewInteger(env, (VAL)); \\\n\t\\\n\tif(_key && _val) \\\n\t{ \\\n\t\tjobject _ret = env->CallObjectMethod((MAP), putMethod, _key, _val); \\\n\t\tif(_ret) env->DeleteLocalRef(_ret); \\\n\t} \\\n\t\\\n\tif(_key) env->DeleteLocalRef(_key); \\\n\tif(_val) env->DeleteLocalRef(_val); \\\n} \\\nwhile(0)\n\n#define JAVA_THROW_EXCEPTION(TEXT, RET) do \\\n{ \\\n\tif(jclass runtimeError = env->FindClass(\"java/lang/Error\")) \\\n\t{ \\\n\t\tenv->ThrowNew(runtimeError, (TEXT)); \\\n\t\tenv->DeleteLocalRef(runtimeError); \\\n\t} \\\n\telse \\\n\t{ \\\n\t\tabort(); \\\n\t} \\\n\treturn (RET); \\\n} \\\nwhile(0)\n\n#define JAVA_TRY_CATCH(FUNC_NAME, RET, ...) \\\n\ttry \\\n\t{ \\\n\t\treturn JAVA_FUNCIMPL(FUNC_NAME)(__VA_ARGS__); \\\n\t} \\\n\tcatch(std::exception e) \\\n\t{ \\\n\t\tJAVA_THROW_EXCEPTION(e.what(), (RET)); \\\n\t} \\\n\tcatch(...) \\\n\t{ \\\n\t\tJAVA_THROW_EXCEPTION(\"An unknown C++ exception has occurred!\", (RET)); \\\n\t}\n\n///////////////////////////////////////////////////////////////////////////////\n// Create Boxed Type\n///////////////////////////////////////////////////////////////////////////////\n\nstatic jobject javaNewInteger(JNIEnv *env, const jint &value)\n{\n\tjclass integerClass;\n\tjmethodID valueOfMethod;\n\tJAVA_FIND_CLASS(integerClass, \"java/lang/Integer\", NULL);\n\tJAVA_GET_METHOD_STATIC(valueOfMethod, integerClass, \"valueOf\", \"(I)Ljava/lang/Integer;\", NULL);\n\tjobject const integerObj = env->CallStaticObjectMethod(integerClass, valueOfMethod, value);\n\tenv->DeleteLocalRef(integerClass);\n\treturn integerObj;\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Logging  Function\n///////////////////////////////////////////////////////////////////////////////\n\nstatic JavaVM *g_javaLoggingJVM = NULL;\nstatic jobject g_javaLoggingHandler = NULL;\n\nstatic jboolean javaLogMessage_Helper(JNIEnv *env, const int &level, const char *const message)\n{\n\tjclass loggerClass = NULL;\n\tjmethodID logMethod = NULL;\n\n\tJAVA_FIND_CLASS(loggerClass, \"com/muldersoft/dynaudnorm/JDynamicAudioNormalizer$Logger\", JNI_FALSE);\n\tJAVA_GET_METHOD(logMethod, loggerClass, \"log\", \"(ILjava/lang/String;)V\", JNI_FALSE);\n\n\tjstring text = env->NewStringUTF(message);\n\tif(text)\n\t{\n\t\tenv->CallVoidMethod(g_javaLoggingHandler, logMethod, level, text);\n\t\tenv->DeleteLocalRef(text);\n\t}\n\n\tenv->DeleteLocalRef(loggerClass);\n\treturn JNI_TRUE;\n}\n\nstatic void javaLogMessage(const int logLevel, const char *const message)\n{\n\tMY_CRITSEC_ENTER(g_javaLock);\n\tif(g_javaLoggingHandler && g_javaLoggingJVM)\n\t{\n\t\tJNIEnv *env = NULL;\n\t\tif(g_javaLoggingJVM->GetEnv((void**)&env, JNI_VERSION_1_6) == JNI_OK)\n\t\t{\n\t\t\tjavaLogMessage_Helper(env, logLevel, message);\n\t\t}\n\t}\n\tMY_CRITSEC_LEAVE(g_javaLock);\n}\n\nstatic void javaSetLoggingHandler(JNIEnv *env, jobject loggerGlobalReference)\n{\n\tMY_CRITSEC_ENTER(g_javaLock);\n\tif(g_javaLoggingHandler)\n\t{\n\t\tenv->DeleteGlobalRef(g_javaLoggingHandler);\n\t\tg_javaLoggingHandler = NULL;\n\t}\n\tif(loggerGlobalReference)\n\t{\n\t\tif(env->GetJavaVM(&g_javaLoggingJVM) == 0)\n\t\t{\n\t\t\tg_javaLoggingHandler = loggerGlobalReference;\n\t\t\tMDynamicAudioNormalizer::setLogFunction(javaLogMessage);\n\t\t}\n\t}\n\tMY_CRITSEC_LEAVE(g_javaLock);\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Instance Handling\n///////////////////////////////////////////////////////////////////////////////\n\n#define MY_RANDOMIZE(X) ((X) = ((((X) * 1103515245) + 12345) & INT32_MAX))\nstatic jint g_nextHandleValue = 0x49A887DC;\nstatic MAP_TYPE<jint, MDynamicAudioNormalizer*> g_instances;\n\nstatic jint javaCreateHandle(MDynamicAudioNormalizer *const instance)\n{\n\tMY_CRITSEC_ENTER(g_javaLock);\n\n\tjint handleValue = MY_RANDOMIZE(g_nextHandleValue);\n\tuint32_t retryCounter = 0;\n\twhile((handleValue <= 0) || (g_instances.find(handleValue) != g_instances.end()))\n\t{\n\t\tif(++retryCounter >= INT32_MAX)\n\t\t{\n\t\t\thandleValue = -1;\n\t\t\tbreak;\n\t\t}\n\t\thandleValue = MY_RANDOMIZE(g_nextHandleValue);\n\t}\n\n\tif(handleValue >= 0)\n\t{\n\t\tg_instances.insert(std::pair<jint, MDynamicAudioNormalizer*>(handleValue, instance));\n\t}\n\n\tMY_CRITSEC_LEAVE(g_javaLock);\n\treturn handleValue;\n}\n\nstatic MDynamicAudioNormalizer *javaHandleToInstance(const jint &handleValue, const bool remove = false)\n{\n\tMY_CRITSEC_ENTER(g_javaLock);\n\n\tMDynamicAudioNormalizer *instance = NULL;\n\tif(g_instances.find(handleValue) != g_instances.end())\n\t{\n\t\tinstance = g_instances[handleValue];\n\t\tif(remove)\n\t\t{\n\t\t\tg_instances.erase(handleValue);\n\t\t}\n\t}\n\n\tMY_CRITSEC_LEAVE(g_javaLock);\n\treturn instance;\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// 2D Array Support\n///////////////////////////////////////////////////////////////////////////////\n\nstatic jboolean javaRelease2DArrayElements(JNIEnv *const env, jobjectArray const outerArray, const jsize &countOuter, double **const arrayElements)\n{\n\tjclass doubleArrayClass;\n\tJAVA_FIND_CLASS(doubleArrayClass, \"[D\", JNI_FALSE);\n\tjboolean success = JNI_TRUE;\n\n\tfor(jsize c = 0; c < countOuter; c++)\n\t{\n\t\tif(arrayElements[c])\n\t\t{\n\t\t\tjobject innerArray = env->GetObjectArrayElement(outerArray, jsize(c));\n\t\t\tif(innerArray)\n\t\t\t{\n\t\t\t\tif(env->IsInstanceOf(innerArray, doubleArrayClass))\n\t\t\t\t{\n\t\t\t\t\tenv->ReleaseDoubleArrayElements(static_cast<jdoubleArray>(innerArray), arrayElements[c], 0);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tsuccess = JNI_FALSE; /*element is not a double array*/\n\t\t\t\t}\n\t\t\t\tenv->DeleteLocalRef(innerArray);\n\t\t\t}\n\t\t\tarrayElements[c] = NULL;\n\t\t}\n\t}\n\n\tenv->DeleteLocalRef(doubleArrayClass);\n\treturn success;\n}\n\nstatic jboolean javaGet2DArrayElements(JNIEnv *const env, const jobjectArray outerArray, const jsize &countOuter, double **arrayElementsOut, jsize &countInnerOut)\n{\n\tjclass doubleArrayClass;\n\tJAVA_FIND_CLASS(doubleArrayClass, \"[D\", JNI_FALSE);\n\tcountInnerOut =  INT32_MAX;\n\tjboolean success = JNI_TRUE;\n\n\tfor(jsize c = 0; c < countOuter; c++)\n\t{\n\t\tarrayElementsOut[c] = NULL;\n\t\tjobject innerArray = env->GetObjectArrayElement(outerArray, jsize(c));\n\t\tif(innerArray)\n\t\t{\n\t\t\tif(env->IsInstanceOf(innerArray, doubleArrayClass))\n\t\t\t{\n\t\t\t\tcountInnerOut = std::min(countInnerOut, env->GetArrayLength(static_cast<jdoubleArray>(innerArray)));\n\t\t\t\tif(!(arrayElementsOut[c] = env->GetDoubleArrayElements(static_cast<jdoubleArray>(innerArray), NULL)))\n\t\t\t\t{\n\t\t\t\t\tsuccess = JNI_FALSE; /*failed to get the array elements*/\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tsuccess = JNI_FALSE; /*element is not a double array*/\n\t\t\t}\n\t\t\tenv->DeleteLocalRef(innerArray);\n\t\t}\n\t}\n\n\tif(!success)\n\t{\n\t\tjavaRelease2DArrayElements(env, outerArray, countOuter, arrayElementsOut);\n\t}\n\n\tenv->DeleteLocalRef(doubleArrayClass);\n\treturn success;\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// JNI Functions\n///////////////////////////////////////////////////////////////////////////////\n\nstatic jboolean JAVA_FUNCIMPL(getVersionInfo)(JNIEnv *const env, jintArray versionInfo)\n{\n\tif(versionInfo == NULL)\n\t{\n\t\treturn JNI_FALSE;\n\t}\n\n\tif(env->GetArrayLength(versionInfo) == 3)\n\t{\n\t\tif(jint *const versionInfoElements = env->GetIntArrayElements(versionInfo, NULL))\n\t\t{\n\t\t\tuint32_t major, minor, patch;\n\t\t\tMDynamicAudioNormalizer::getVersionInfo(major, minor, patch);\n\n\t\t\tversionInfoElements[0] = (int32_t) std::min(major, uint32_t(INT32_MAX));\n\t\t\tversionInfoElements[1] = (int32_t) std::min(minor, uint32_t(INT32_MAX));\n\t\t\tversionInfoElements[2] = (int32_t) std::min(patch, uint32_t(INT32_MAX));\n\n\t\t\tenv->ReleaseIntArrayElements(versionInfo, versionInfoElements, 0);\n\t\t\treturn JNI_TRUE;\n\t\t}\n\t}\n\n\treturn JNI_FALSE;\n}\n\nstatic jboolean JAVA_FUNCIMPL(getBuildInfo)(JNIEnv *const env, jobject const buildInfo)\n{\n\tif(buildInfo == NULL)\n\t{\n\t\treturn JNI_FALSE;\n\t}\n\n\tjclass mapClass = NULL;\n\tjmethodID putMethod = NULL, clearMethod = NULL;\n\n\tJAVA_FIND_CLASS(mapClass, \"java/util/Map\", JNI_FALSE);\n\tJAVA_GET_METHOD(putMethod, mapClass, \"put\", \"(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\", JNI_FALSE);\n\tJAVA_GET_METHOD(clearMethod, mapClass, \"clear\", \"()V\", JNI_FALSE);\n\n\tif(!env->IsInstanceOf(buildInfo, mapClass))\n\t{\n\t\treturn JNI_FALSE;\n\t}\n\n\tenv->CallVoidMethod(buildInfo, clearMethod);\n\n\tconst char *date, *time, *compiler, *arch;\n\tbool debug;\n\tMDynamicAudioNormalizer::getBuildInfo(&date, &time, &compiler, &arch, debug);\n\n\tJAVA_MAP_PUT_STRING(buildInfo, \"BuildDate\",    date);\n\tJAVA_MAP_PUT_STRING(buildInfo, \"BuildTime\",    time);\n\tJAVA_MAP_PUT_STRING(buildInfo, \"Compiler\",     compiler);\n\tJAVA_MAP_PUT_STRING(buildInfo, \"Architecture\", arch);\n\tJAVA_MAP_PUT_STRING(buildInfo, \"DebugBuild\",   debug ? \"Yes\" : \"No\");\n\n\tenv->DeleteLocalRef(mapClass);\n\treturn JNI_TRUE;\n}\n\nstatic jboolean JAVA_FUNCIMPL(setLoggingHandler)(JNIEnv *const env, jobject const loggerObject)\n{\n\tif(loggerObject == NULL)\n\t{\n\t\tjavaSetLoggingHandler(env, NULL);\n\t\treturn JNI_TRUE;\n\t}\n\n\tjclass loggerClass = NULL;\n\tJAVA_FIND_CLASS(loggerClass, \"com/muldersoft/dynaudnorm/JDynamicAudioNormalizer$Logger\", JNI_FALSE);\n\n\tif(!env->IsInstanceOf(loggerObject, loggerClass))\n\t{\n\t\treturn JNI_FALSE;\n\t}\n\n\tjobject globalReference = env->NewGlobalRef(loggerObject);\n\tif(globalReference)\n\t{\n\t\tjavaSetLoggingHandler(env, globalReference);\n\t\treturn JNI_TRUE;\n\t}\n\n\tenv->DeleteLocalRef(loggerClass);\n\treturn JNI_FALSE;\n}\n\nstatic jint JAVA_FUNCIMPL(createInstance)(JNIEnv *const env, const jint &channels, const jint &sampleRate, const jint &frameLenMsec, const jint &filterSize, const jdouble &peakValue, const jdouble &maxAmplification, const jdouble &targetRms, const jdouble &compressFactor, const jboolean &channelsCoupled, const jboolean &enableDCCorrection, const jboolean &altBoundaryMode)\n{\n\tif((channels > 0) && (sampleRate > 0) && (frameLenMsec > 0) & (filterSize > 0))\n\t{\n\t\tMDynamicAudioNormalizer *instance = new MDynamicAudioNormalizer(channels, sampleRate, frameLenMsec, filterSize, peakValue, maxAmplification, targetRms, compressFactor, (channelsCoupled != JNI_FALSE), (enableDCCorrection != JNI_FALSE), (altBoundaryMode != JNI_FALSE));\n\t\tif(!instance->initialize())\n\t\t{\n\t\t\tdelete instance;\n\t\t\treturn -1;\n\t\t}\n\n\t\tconst jint handle = javaCreateHandle(instance);\n\t\tif(handle < 0)\n\t\t{\n\t\t\tdelete instance;\n\t\t\treturn -1;\n\t\t}\n\n\t\treturn handle;\n\t}\n\treturn -1;\n}\n\nstatic jboolean JAVA_FUNCIMPL(destroyInstance)(JNIEnv *const env, const jint &handle)\n{\n\tif(MDynamicAudioNormalizer *const instance = javaHandleToInstance(handle, true))\n\t{\n\t\tdelete instance;\n\t\treturn JNI_TRUE;\n\t}\n\n\treturn JNI_FALSE;\n}\n\nstatic jlong JAVA_FUNCIMPL(process)(JNIEnv *const env, const jint &handle, jobjectArray const samplesIn, jobjectArray const samplesOut, const jlong &inputSize)\n{\n\tif ((handle < 0) || (samplesIn == NULL) || (samplesOut == NULL)  || (inputSize < 1))\n\t{\n\t\treturn -1; /*invalid parameters detected*/\n\t}\n\n\tMDynamicAudioNormalizer *const instance = javaHandleToInstance(handle);\n\tif (instance == NULL)\n\t{\n\t\treturn -1; /*invalid handle value*/\n\t}\n\n\tuint32_t channels, sampleRate, frameLen, filterSize;\n\tif (!instance->getConfiguration(channels, sampleRate, frameLen, filterSize))\n\t{\n\t\treturn -1; /*unable to get configuration*/\n\t}\n\n\tif ((env->GetArrayLength(samplesIn) < jint(channels)) || (env->GetArrayLength(samplesOut) < jint(channels)))\n\t{\n\t\treturn -1; /*array diemnsion is too small*/\n\t}\n\n\tdouble **arrayElementsIn  = (double**)alloca(sizeof(double*) * channels);\n\tjsize arrayLengthIn = 0;\n\tif (!javaGet2DArrayElements(env, samplesIn, channels, arrayElementsIn, arrayLengthIn))\n\t{\n\t\treturn -1; /*failed to retrieve the array elements*/\n\t}\n\n\tdouble **arrayElementsOut = (double**)alloca(sizeof(double*) * channels);\n\tjsize arrayLengthOut = 0;\n\tif (!javaGet2DArrayElements(env, samplesOut, channels, arrayElementsOut, arrayLengthOut))\n\t{\n\t\treturn -1; /*failed to retrieve the array elements*/\n\t}\n\n\tint64_t outputSize = 0;\n\tconst bool success = instance->process(arrayElementsIn, arrayElementsOut, std::min(inputSize, std::min(jlong(arrayLengthIn), jlong(arrayLengthOut))), outputSize);\n\n\tif (!javaRelease2DArrayElements(env, samplesIn, channels, arrayElementsIn))\n\t{\n\t\treturn -1; /*failed to release the array elements*/\n\t}\n\n\tif (!javaRelease2DArrayElements(env, samplesOut, channels, arrayElementsOut))\n\t{\n\t\treturn -1; /*failed to release the array elements*/\n\t}\n\n\treturn success ? outputSize : (-1);\n}\n\nstatic jlong JAVA_FUNCIMPL(processInplace)(JNIEnv *const env, const jint &handle, jobjectArray const samplesInOut, const jlong &inputSize)\n{\n\tif((handle < 0) || (samplesInOut == NULL) || (inputSize < 1))\n\t{\n\t\treturn -1; /*invalid parameters detected*/\n\t}\n\n\tMDynamicAudioNormalizer *const instance = javaHandleToInstance(handle);\n\tif(instance == NULL)\n\t{\n\t\treturn -1; /*invalid handle value*/\n\t}\n\n\tuint32_t channels, sampleRate, frameLen, filterSize;\n\tif(!instance->getConfiguration(channels, sampleRate, frameLen, filterSize))\n\t{\n\t\treturn -1; /*unable to get configuration*/\n\t}\n\n\tif(env->GetArrayLength(samplesInOut) < jint(channels))\n\t{\n\t\treturn -1; /*array diemnsion is too small*/\n\t}\n\n\tdouble **arrayElements = (double**) alloca(sizeof(double*) * channels);\n\tjsize arrayLength = 0;\n\tif(!javaGet2DArrayElements(env, samplesInOut, channels, arrayElements, arrayLength))\n\t{\n\t\treturn -1; /*failed to retrieve the array elements*/\n\t}\n\n\tint64_t outputSize = 0;\n\tconst bool success = instance->processInplace(arrayElements, std::min(inputSize, jlong(arrayLength)), outputSize);\n\n\tif(!javaRelease2DArrayElements(env, samplesInOut, channels, arrayElements))\n\t{\n\t\treturn -1; /*failed to release the array elements*/\n\t}\n\n\treturn success ? outputSize : (-1);\n}\n\nstatic jlong JAVA_FUNCIMPL(flushBuffer)(JNIEnv *const env, const jint &handle, jobjectArray const samplesOut)\n{\n\tif((handle < 0) || (samplesOut == NULL))\n\t{\n\t\treturn -1; /*invalid parameters detected*/\n\t}\n\n\tMDynamicAudioNormalizer *const instance = javaHandleToInstance(handle);\n\tif(instance == NULL)\n\t{\n\t\treturn -1; /*invalid handle value*/\n\t}\n\n\tuint32_t channels, sampleRate, frameLen, filterSize;\n\tif(!instance->getConfiguration(channels, sampleRate, frameLen, filterSize))\n\t{\n\t\treturn -1; /*unable to get configuration*/\n\t}\n\n\tif(env->GetArrayLength(samplesOut) < jint(channels))\n\t{\n\t\treturn -1; /*array diemnsion is too small*/\n\t}\n\n\tdouble **arrayElements = (double**) alloca(sizeof(double*) * channels);\n\tjsize arrayLength = 0;\n\tif(!javaGet2DArrayElements(env, samplesOut, channels, arrayElements, arrayLength))\n\t{\n\t\treturn -1; /*failed to retrieve the array elements*/\n\t}\n\n\tint64_t outputSize = 0;\n\tconst bool success = instance->flushBuffer(arrayElements, arrayLength, outputSize);\n\n\tif(!javaRelease2DArrayElements(env, samplesOut, channels, arrayElements))\n\t{\n\t\treturn -1; /*failed to release the array elements*/\n\t}\n\n\treturn success ? outputSize : (-1);\n}\n\nstatic jboolean JAVA_FUNCIMPL(reset)(JNIEnv *const env, const jint &handle)\n{\n\tif(handle < 0)\n\t{\n\t\treturn JNI_FALSE;\n\t}\n\n\tMDynamicAudioNormalizer *const instance = javaHandleToInstance(handle);\n\tif(instance == NULL)\n\t{\n\t\treturn JNI_FALSE; /*invalid handle value*/\n\t}\n\n\treturn instance->reset() ? JNI_TRUE : JNI_FALSE;\n}\n\nstatic jboolean JAVA_FUNCIMPL(getConfiguration)(JNIEnv *const env, const jint &handle, jobject const configuration)\n{\n\tif((handle < 0) || (configuration == NULL))\n\t{\n\t\treturn JNI_FALSE;\n\t}\n\n\tMDynamicAudioNormalizer *const instance = javaHandleToInstance(handle);\n\tif(instance == NULL)\n\t{\n\t\treturn JNI_FALSE; /*invalid handle value*/\n\t}\n\n\tjclass mapClass = NULL;\n\tjmethodID putMethod = NULL, clearMethod = NULL;\n\n\tJAVA_FIND_CLASS(mapClass, \"java/util/Map\", JNI_FALSE);\n\tJAVA_GET_METHOD(putMethod, mapClass, \"put\", \"(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\", JNI_FALSE);\n\tJAVA_GET_METHOD(clearMethod, mapClass, \"clear\", \"()V\", JNI_FALSE);\n\n\tif(!env->IsInstanceOf(configuration, mapClass))\n\t{\n\t\treturn JNI_FALSE;\n\t}\n\n\tenv->CallVoidMethod(configuration, clearMethod);\n\n\tuint32_t channels, sampleRate, frameLen, filterSize;\n\tif(!instance->getConfiguration(channels, sampleRate, frameLen, filterSize))\n\t{\n\t\treturn JNI_FALSE;\n\t}\n\n\tJAVA_MAP_PUT_INTEGER(configuration, \"channelCount\",   static_cast<jint>(channels));\n\tJAVA_MAP_PUT_INTEGER(configuration, \"sampleRate\",     static_cast<jint>(sampleRate));\n\tJAVA_MAP_PUT_INTEGER(configuration, \"frameLen\",       static_cast<jint>(frameLen));\n\tJAVA_MAP_PUT_INTEGER(configuration, \"filterSize\",     static_cast<jint>(filterSize));\n\n\tenv->DeleteLocalRef(mapClass);\n\treturn JNI_TRUE;\n}\n\nstatic jlong JAVA_FUNCIMPL(getInternalDelay)(JNIEnv *const env, const jint &handle)\n{\n\tif(handle < 0)\n\t{\n\t\treturn -1;\n\t}\n\n\tMDynamicAudioNormalizer *const instance = javaHandleToInstance(handle);\n\tif(instance == NULL)\n\t{\n\t\treturn -1; /*invalid handle value*/\n\t}\n\n\tint64_t delayInSamples = 0;\n\tif(!instance->getInternalDelay(delayInSamples))\n\t{\n\t\tdelayInSamples = -1;\n\t}\n\n\treturn delayInSamples;\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// JNI Entry Points\n///////////////////////////////////////////////////////////////////////////////\n\nextern \"C\"\n{\n\tJNIEXPORT jboolean JNICALL JAVA_FUNCTION(getVersionInfo)(JNIEnv *const env, jobject, jintArray versionInfo)\n\t{\n\t\tJAVA_TRY_CATCH(getVersionInfo, JNI_FALSE, env, versionInfo)\n\t}\n\n\tJNIEXPORT jboolean JNICALL JAVA_FUNCTION(getBuildInfo)(JNIEnv *const env, jobject, jobject buildInfo)\n\t{\n\t\tJAVA_TRY_CATCH(getBuildInfo, JNI_FALSE, env, buildInfo)\n\t}\n\n\tJNIEXPORT jboolean JNICALL JAVA_FUNCTION(setLoggingHandler)(JNIEnv *const env, jobject, jobject loggerObject)\n\t{\n\t\tJAVA_TRY_CATCH(setLoggingHandler, JNI_FALSE, env, loggerObject)\n\t}\n\n\tJNIEXPORT jint JNICALL JAVA_FUNCTION(createInstance)(JNIEnv *const env, jobject, jint channels, jint sampleRate, jint frameLenMsec, jint filterSize, jdouble peakValue, jdouble maxAmplification, jdouble targetRms, jdouble compressFactor, jboolean channelsCoupled, jboolean enableDCCorrection, jboolean altBoundaryMode)\n\t{\n\t\tJAVA_TRY_CATCH(createInstance, -1, env, channels, sampleRate, frameLenMsec, filterSize, peakValue, maxAmplification, targetRms, compressFactor, channelsCoupled, enableDCCorrection, altBoundaryMode)\n\t}\n\n\tJNIEXPORT jboolean JNICALL JAVA_FUNCTION(destroyInstance)(JNIEnv *const env, jobject, jint instance)\n\t{\n\t\tJAVA_TRY_CATCH(destroyInstance, JNI_FALSE, env, instance)\n\t}\n\n\tJNIEXPORT jlong JNICALL JAVA_FUNCTION(process)(JNIEnv *const env, jobject,  jint handle, jobjectArray samplesIn, jobjectArray samplesOut, jlong inputSize)\n\t{\n\t\tJAVA_TRY_CATCH(process, -1, env, handle, samplesIn, samplesOut, inputSize)\n\t}\n\n\tJNIEXPORT jlong JNICALL JAVA_FUNCTION(processInplace)(JNIEnv *const env, jobject, jint handle, jobjectArray samplesInOut, jlong inputSize)\n\t{\n\t\tJAVA_TRY_CATCH(processInplace, -1, env, handle, samplesInOut, inputSize)\n\t}\n\n\tJNIEXPORT jlong JNICALL JAVA_FUNCTION(flushBuffer)(JNIEnv *const env, jobject, jint handle, jobjectArray samplesOut)\n\t{\n\t\tJAVA_TRY_CATCH(flushBuffer, -1, env, handle, samplesOut)\n\t}\n\n\tJNIEXPORT jboolean JNICALL JAVA_FUNCTION(reset)(JNIEnv *const env, jobject, jint handle)\n\t{\n\t\tJAVA_TRY_CATCH(reset, JNI_FALSE, env, handle)\n\t}\n\n\tJNIEXPORT jboolean JNICALL JAVA_FUNCTION(getConfiguration)(JNIEnv *const env, jobject, jint handle, jobject configuration)\n\t{\n\t\tJAVA_TRY_CATCH(getConfiguration, JNI_FALSE, env, handle, configuration)\n\t}\n\n\tJNIEXPORT jlong JNICALL JAVA_FUNCTION(getInternalDelay)(JNIEnv *const env, jobject, jint handle)\n\t{\n\t\tJAVA_TRY_CATCH(getInternalDelay, -1, env, handle)\n\t}\n}\n\n\n#endif //NO_JAVA_SUPPORT\n\n"
  },
  {
    "path": "DynamicAudioNormalizerAPI/src/DLLMain.cpp",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Library\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This library is free software; you can redistribute it and/or\n// modify it under the terms of the GNU Lesser General Public\n// License as published by the Free Software Foundation; either\n// version 2.1 of the License, or (at your option) any later version.\n//\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public\n// License along with this library; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n//\n// http://www.gnu.org/licenses/lgpl-2.1.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#ifdef _WIN32 /*Win32 only*/\n#ifndef MDYNAMICAUDIONORMALIZER_STATIC /*only if building DLL*/\n\n//Windows\n#define WIN32_LEAN_AND_MEAN\n#include <Windows.h>\n\n//VLD\n#ifndef __MINGW32__\n#include <vld.h>\n#endif\n\nBOOL APIENTRY DllMain(HMODULE hModule,DWORD  ul_reason_for_call, LPVOID lpReserved)\n{\n\tswitch (ul_reason_for_call)\n\t{\n\tcase DLL_PROCESS_ATTACH:\n\tcase DLL_THREAD_ATTACH:\n\tcase DLL_THREAD_DETACH:\n\tcase DLL_PROCESS_DETACH:\n\t\tbreak;\n\t}\n\treturn TRUE;\n}\n\n#endif //MDYNAMICAUDIONORMALIZER_STATIC\n#endif //_WIN32\n"
  },
  {
    "path": "DynamicAudioNormalizerAPI/src/DynamicAudioNormalizer.cpp",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Library\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This library is free software; you can redistribute it and/or\n// modify it under the terms of the GNU Lesser General Public\n// License as published by the Free Software Foundation; either\n// version 2.1 of the License, or (at your option) any later version.\n//\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public\n// License along with this library; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n//\n// http://www.gnu.org/licenses/lgpl-2.1.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#ifndef __STDC_FORMAT_MACROS\n#define __STDC_FORMAT_MACROS 1\n#endif\n\n#include \"DynamicAudioNormalizer.h\"\n\n#include \"Common.h\"\n#include \"FrameBuffer.h\"\n#include \"GaussianFilter.h\"\n#include \"Logging.h\"\n#include \"Version.h\"\n\n#include <cmath>\n#include <algorithm>\n#include <queue>\n#include <deque>\n#include <cassert>\n#include <stdexcept> \n#include <cfloat>\n#include <inttypes.h>\n\n///////////////////////////////////////////////////////////////////////////////\n// Constants\n///////////////////////////////////////////////////////////////////////////////\n\nstatic const uint32_t CHANNELS_MIN =  1U;\nstatic const uint32_t CHANNELS_MAX = 16U;\n\nstatic const uint32_t SAMPLERATE_MIN =   8000U;\nstatic const uint32_t SAMPLERATE_MAX = 192000U;\n\nstatic const uint32_t FRAMELEN_MIN =      32U;\nstatic const uint32_t FRAMELEN_MAX = 2097152U;\n\n///////////////////////////////////////////////////////////////////////////////\n// Static Initializer\n///////////////////////////////////////////////////////////////////////////////\n\nnamespace DYNAUDNORM_NS\n{\n\tclass StaticInitializer\n\t{\n\tpublic:\n\t\tStaticInitializer(void)\n\t\t{\n#if defined(_MSC_VER) && (_MSC_VER >= 1800) && (_MSC_VER < 1900) && defined(_M_X64) && (_M_X64 >= 100)\n\t\t\t// FMA3 support in the MSVC 2013 CRT is broken on Vista and Windows 7 RTM (fixed in SP1).\n\t\t\t// See https://connect.microsoft.com/VisualStudio/feedback/details/987093/x64-log-function-uses-vpsrlq-avx-instruction-without-regard-to-operating-system-so-it-crashes-on-vista-x64\n\t\t\t_set_FMA3_enable(0);\n#endif\n\t\t}\n\t};\n}\n\nstatic const DYNAUDNORM_NS::StaticInitializer g_static_init;\n\n///////////////////////////////////////////////////////////////////////////////\n// Utility Functions\n///////////////////////////////////////////////////////////////////////////////\n\n#undef LOG_AMPFACTORS\n#ifdef LOG_AMPFACTORS\nstatic void LOG_VALUE(const double &value, const double &prev, const double &curr, const double &next, const uint32_t &channel, const uint32_t &pos)\n{\n\tstatic FILE *g_myLogfile = FOPEN(TXT(\"ampFactors.log\"), TXT(\"w\"));\n\tif(g_myLogfile && (channel == 0) && (pos % 10 == 0))\n\t{\n\t\tfprintf(g_myLogfile, \"%.8f\\t%.8f %.8f %.8f\\n\", value, prev, curr, next);\n\t}\n}\n#else\n#define LOG_VALUE(...) ((void)0)\n#endif\n\ntemplate<typename T> static inline T LIMIT(const T &min, const T &val, const T &max)\n{\n\treturn std::min(max, std::max(min, val));\n}\n\ntemplate<typename T> static inline void UPDATE_MAX(T &max, const T &val)\n{\n\tif (val > max) { max = val; }\n}\n\nstatic inline uint32_t FRAME_SIZE(const uint32_t &sampleRate, const uint32_t &frameLenMsec)\n{\n\tconst uint32_t frameSize = static_cast<uint32_t>(round(double(sampleRate) * (double(frameLenMsec) / 1000.0)));\n\treturn frameSize + (frameSize % 2);\n}\n\nstatic inline double UPDATE_VALUE(const double &NEW, const double &OLD, const double &aggressiveness)\n{\n\tassert((aggressiveness >= 0.0) && (aggressiveness <= 1.0));\n\treturn (aggressiveness * NEW) + ((1.0 - aggressiveness) * OLD);\n}\n\nstatic inline double FADE(const double &prev, const double &next, const uint32_t &pos, const double *const fadeFactors[2])\n{\n\treturn (fadeFactors[0][pos] * prev) + (fadeFactors[1][pos] * next);\n}\n\nstatic inline double BOUND(const double &threshold, const double &val)\n{\n\tconst double SQRT_PI = 0.8862269254527580136490837416705725913987747280611935; //sqrt(PI) / 2.0\n\treturn erf(SQRT_PI * (val / threshold)) * threshold;\n}\n\nstatic inline double POW2(const double &value)\n{\n\treturn value * value;\n}\n\n#define BOOLIFY(X) ((X) ? \"YES\" : \"NO\")\n#define POW2(X) ((X)*(X))\n\n#define CLEAR_QUEUE(X) do \\\n{ \\\n\twhile(!(X).empty()) (X).pop(); \\\n} \\\nwhile(0)\n\n///////////////////////////////////////////////////////////////////////////////\n// MDynamicAudioNormalizer_PrivateData\n///////////////////////////////////////////////////////////////////////////////\n\nclass MDynamicAudioNormalizer_PrivateData\n{\npublic:\n\tMDynamicAudioNormalizer_PrivateData(const uint32_t channels, const uint32_t sampleRate, const uint32_t frameLenMsec, const uint32_t filterSize, const double peakValue, const double maxAmplification, const double targetRms, const double compressThresh, const bool channelsCoupled, const bool enableDCCorrection, const bool altBoundaryMode, FILE *const logFile);\n\t~MDynamicAudioNormalizer_PrivateData(void);\n\n\tbool initialize(void);\n\tbool process(const double *const *const samplesIn, double *const *const samplesOut, const int64_t inputSize, int64_t &outputSize, const bool &bFlush);\n\tbool flushBuffer(double *const *const samplesOut, const int64_t bufferSize, int64_t &outputSize);\n\tbool reset(void);\n\tbool getConfiguration(uint32_t &channels, uint32_t &sampleRate, uint32_t &frameLen, uint32_t &filterSize);\n\tbool getInternalDelay(int64_t &delayInSamples);\n\nprivate:\n\tconst uint32_t m_channels;\n\tconst uint32_t m_sampleRate;\n\tconst uint32_t m_frameLen;\n\tconst uint32_t m_filterSize;\n\tconst uint32_t m_prefillLen;\n\tconst uint32_t m_delay;\n\n\tconst double m_peakValue;\n\tconst double m_maxAmplification;\n\tconst double m_targetRms;\n\tconst double m_compressFactor;\n\n\tconst bool m_channelsCoupled;\n\tconst bool m_enableDCCorrection;\n\tconst bool m_altBoundaryMode;\n\n\tFILE *const m_logFile;\n\t\n\tbool m_initialized;\n\tbool m_flushBuffer;\n\n\tDYNAUDNORM_NS::FrameFIFO *m_buffSrc;\n\tDYNAUDNORM_NS::FrameFIFO *m_buffOut;\n\t\n\tint64_t m_delayedSamples;\n\n\tuint64_t m_sampleCounterTotal;\n\tuint64_t m_sampleCounterClips;\n\tuint64_t m_sampleCounterCompr;\n\n\tDYNAUDNORM_NS::FrameBuffer *m_frameBuffer;\n\n\tstd::deque<double> *m_gainHistory_original;\n\tstd::deque<double> *m_gainHistory_minimum;\n\tstd::deque<double> *m_gainHistory_smoothed;\n\n\tstd::queue<double> *m_loggingData_original;\n\tstd::queue<double> *m_loggingData_minimum;\n\tstd::queue<double> *m_loggingData_smoothed;\n\n\tDYNAUDNORM_NS::GaussianFilter *m_gaussianFilter;\n\n\tdouble *m_prevAmplificationFactor;\n\tdouble *m_dcCorrectionValue;\n\tdouble *m_compressThreshold;\n\n\tdouble *m_fadeFactors[2];\n\nprotected:\n\tvoid analyzeFrame(DYNAUDNORM_NS::FrameData *const frame);\n\tvoid amplifyFrame(DYNAUDNORM_NS::FrameData *const frame);\n\t\n\tdouble getMaxLocalGain(DYNAUDNORM_NS::FrameData *const frame, const uint32_t channel = UINT32_MAX);\n\tdouble findPeakMagnitude(DYNAUDNORM_NS::FrameData *const frame, const uint32_t channel = UINT32_MAX);\n\tdouble computeFrameRMS(const DYNAUDNORM_NS::FrameData *const frame, const uint32_t channel = UINT32_MAX);\n\tdouble computeFrameStdDev(const DYNAUDNORM_NS::FrameData *const frame, const uint32_t channel = UINT32_MAX);\n\tvoid updateGainHistory(const uint32_t &channel, const double &currentGainFactor);\n\tvoid perfromDCCorrection(DYNAUDNORM_NS::FrameData *const frame, const bool &isFirstFrame);\n\tvoid perfromCompression(DYNAUDNORM_NS::FrameData *const frame, const bool &isFirstFrame);\n\tvoid writeLogFile(void);\n\tvoid printParameters(void);\n\t\n\tstatic void precalculateFadeFactors(double *const fadeFactors[2], const uint32_t frameLen);\n\tstatic double setupCompressThresh(const double &dThreshold);\n};\n\n///////////////////////////////////////////////////////////////////////////////\n// Constructor & Destructor\n///////////////////////////////////////////////////////////////////////////////\n\nMDynamicAudioNormalizer::MDynamicAudioNormalizer(const uint32_t channels, const uint32_t sampleRate, const uint32_t frameLenMsec, const uint32_t filterSize, const double peakValue, const double maxAmplification, const double targetRms, const double compressThresh, const bool channelsCoupled, const bool enableDCCorrection, const bool altBoundaryMode, FILE *const logFile)\n:\n\tp(new MDynamicAudioNormalizer_PrivateData(channels, sampleRate, frameLenMsec, filterSize, peakValue, maxAmplification, targetRms, compressThresh, channelsCoupled, enableDCCorrection, altBoundaryMode,logFile))\n{\n\t/*nothing to do here*/\n}\n\nMDynamicAudioNormalizer_PrivateData::MDynamicAudioNormalizer_PrivateData(const uint32_t channels, const uint32_t sampleRate, const uint32_t frameLenMsec, const uint32_t filterSize, const double peakValue, const double maxAmplification, const double targetRms, const double compressFactor, const bool channelsCoupled, const bool enableDCCorrection, const bool altBoundaryMode, FILE *const logFile)\n:\n\tm_channels(channels),\n\tm_sampleRate(sampleRate),\n\tm_frameLen(FRAME_SIZE(sampleRate, frameLenMsec)),\n\tm_filterSize(LIMIT(3u, filterSize, 301u)),\n\tm_prefillLen(m_filterSize / 2u),\n\tm_delay(m_frameLen * m_filterSize),\n\tm_peakValue(LIMIT(0.01, peakValue, 1.0)),\n\tm_maxAmplification(LIMIT(1.0, maxAmplification, 100.0)),\n\tm_targetRms(LIMIT(0.0, targetRms, 1.0)),\n\tm_compressFactor(compressFactor ? LIMIT(1.0, compressFactor, 30.0) : 0.0),\n\tm_channelsCoupled(channelsCoupled),\n\tm_enableDCCorrection(enableDCCorrection),\n\tm_altBoundaryMode(altBoundaryMode),\n\tm_logFile(logFile)\n{\n\t// LOG2_DBG(\"channels: %u\",           channels);\n\t// LOG2_DBG(\"sampleRate: %u\",         sampleRate);\n\t// LOG2_DBG(\"frameLenMsec: %u\",       frameLenMsec);\n\t// LOG2_DBG(\"filterSize: %u\",         filterSize);\n\t// LOG2_DBG(\"peakValue: %.4f\",        peakValue);\n\t// LOG2_DBG(\"maxAmplification: %.4f\", maxAmplification);\n\t// LOG2_DBG(\"targetRms: %.4f\",        targetRms);\n\t// LOG2_DBG(\"compressFactor: %.4f\",   compressFactor);\n\t// LOG2_DBG(\"channelsCoupled: %s\",    channelsCoupled    ? \"YES\" : \"NO\");\n\t// LOG2_DBG(\"enableDCCorrection: %s\", enableDCCorrection ? \"YES\" : \"NO\");\n\t// LOG2_DBG(\"altBoundaryMode: %s\",    altBoundaryMode    ? \"YES\" : \"NO\");\n\t// LOG2_DBG(\"logFile: %p\",            logFile);\n\t\n\tm_initialized = false;\n\tm_flushBuffer = false;\n\n\tm_buffSrc = NULL;\n\tm_buffOut = NULL;\n\t\n\tm_delayedSamples = 0;\n\tm_sampleCounterClips = m_sampleCounterTotal = 0;\n\n\tm_frameBuffer = NULL;\n\tm_gaussianFilter = NULL;\n\n\tm_gainHistory_original = NULL;\n\tm_gainHistory_minimum  = NULL;\n\tm_gainHistory_smoothed = NULL;\n\n\tm_loggingData_original = NULL;\n\tm_loggingData_minimum  = NULL;\n\tm_loggingData_smoothed = NULL;\n\n\tm_prevAmplificationFactor = NULL;\n\tm_dcCorrectionValue = NULL;\n\tm_compressThreshold = NULL;\n\n\tm_fadeFactors[0] = m_fadeFactors[1] = NULL;\n}\n\nMDynamicAudioNormalizer::~MDynamicAudioNormalizer(void)\n{\n\tdelete p;\n}\n\nMDynamicAudioNormalizer_PrivateData::~MDynamicAudioNormalizer_PrivateData(void)\n{\n\tLOG2_DBG(\"Processed %\" PRIu64 \" samples total, clipped %\" PRIu64 \" samples (%.2f%%).\",\n\t\tm_sampleCounterTotal,\n\t\tm_sampleCounterClips,\n\t\tm_sampleCounterTotal ? (double(m_sampleCounterClips) / double(m_sampleCounterTotal) * 100.0) : 0.0\n\t);\n\n\tMY_DELETE(m_buffSrc);\n\tMY_DELETE(m_buffOut);\n\n\tMY_DELETE(m_frameBuffer);\n\tMY_DELETE(m_gaussianFilter);\n\t\n\tMY_DELETE_ARRAY(m_gainHistory_original);\n\tMY_DELETE_ARRAY(m_gainHistory_minimum );\n\tMY_DELETE_ARRAY(m_gainHistory_smoothed);\n\n\tMY_DELETE_ARRAY(m_loggingData_original);\n\tMY_DELETE_ARRAY(m_loggingData_minimum );\n\tMY_DELETE_ARRAY(m_loggingData_smoothed);\n\n\tMY_DELETE_ARRAY(m_prevAmplificationFactor);\n\tMY_DELETE_ARRAY(m_dcCorrectionValue);\n\tMY_DELETE_ARRAY(m_compressThreshold);\n\n\tMY_DELETE_ARRAY(m_fadeFactors[0]);\n\tMY_DELETE_ARRAY(m_fadeFactors[1]);\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Public API\n///////////////////////////////////////////////////////////////////////////////\n\nbool MDynamicAudioNormalizer::initialize(void)\n{\n\ttry\n\t{\n\t\treturn p->initialize();\n\t}\n\tcatch(std::exception &e)\n\t{\n\t\tLOG1_ERR(e.what());\n\t\treturn false;\n\t}\n}\n\nbool MDynamicAudioNormalizer_PrivateData::initialize(void)\n{\n\tif(m_initialized)\n\t{\n\t\tLOG1_WRN(\"Already initialized -> ignoring!\");\n\t\treturn true;\n\t}\n\n\tif((m_channels < CHANNELS_MIN) || (m_channels > CHANNELS_MAX))\n\t{\n\t\tLOG2_ERR(\"Invalid or unsupported channel count. Should be in the %u to %u range!\", CHANNELS_MIN, CHANNELS_MAX);\n\t\treturn false;\n\t}\n\tif((m_sampleRate < SAMPLERATE_MIN) || (m_sampleRate > SAMPLERATE_MAX))\n\t{\n\t\tLOG2_ERR(\"Invalid or unsupported sampling rate. Should be in the %u to %u range!\", SAMPLERATE_MIN, SAMPLERATE_MAX);\n\t\treturn false;\n\t}\n\tif((m_frameLen < FRAMELEN_MIN) || (m_frameLen > FRAMELEN_MAX))\n\t{\n\t\tLOG2_ERR(\"Invalid or unsupported frame size. Should be in the %u to %u range!\", FRAMELEN_MIN, FRAMELEN_MAX);\n\t\treturn false;\n\t}\n\tif(m_logFile && (ferror(m_logFile) != 0))\n\t{\n\t\tLOG1_WRN(\"Specified log file has the error indicator set, no logging information will be created!\");\n\t}\n\n\tm_buffSrc = new DYNAUDNORM_NS::FrameFIFO(m_channels, m_frameLen);\n\tm_buffOut = new DYNAUDNORM_NS::FrameFIFO(m_channels, m_frameLen);\n\n\tm_frameBuffer = new DYNAUDNORM_NS::FrameBuffer(m_channels, m_frameLen, m_filterSize + 1);\n\n\tm_gainHistory_original = new std::deque<double>[m_channels];\n\tm_gainHistory_minimum  = new std::deque<double>[m_channels];\n\tm_gainHistory_smoothed = new std::deque<double>[m_channels];\n\n\tm_loggingData_original = new std::queue<double>[m_channels];\n\tm_loggingData_minimum  = new std::queue<double>[m_channels];\n\tm_loggingData_smoothed = new std::queue<double>[m_channels];\n\n\tconst double sigma = (((double(m_filterSize) / 2.0) - 1.0) / 3.0) + (1.0 / 3.0);\n\tm_gaussianFilter = new DYNAUDNORM_NS::GaussianFilter(m_filterSize, sigma);\n\n\tm_dcCorrectionValue       = new double[m_channels];\n\tm_prevAmplificationFactor = new double[m_channels];\n\tm_compressThreshold       = new double[m_channels];\n\n\tm_fadeFactors[0] = new double[m_frameLen];\n\tm_fadeFactors[1] = new double[m_frameLen];\n\t\n\tprecalculateFadeFactors(m_fadeFactors, m_frameLen);\n\tprintParameters();\n\n\tif(m_logFile)\n\t{\n\t\tfprintf(m_logFile, \"DynamicAudioNormalizer Logfile v%u.%02u-%u\\n\", DYNAUDNORM_NS::VERSION_MAJOR, DYNAUDNORM_NS::VERSION_MINOR, DYNAUDNORM_NS::VERSION_PATCH);\n\t\tfprintf(m_logFile, \"CHANNEL_COUNT:%u\\n\\n\", m_channels);\n\t}\n\n\tm_initialized = true;\n\treset();\n\treturn true;\n}\n\nbool MDynamicAudioNormalizer::reset(void)\n{\n\ttry\n\t{\n\t\treturn p->reset();\n\t}\n\tcatch(std::exception &e)\n\t{\n\t\tLOG1_ERR(e.what());\n\t\treturn false;\n\t}\n}\n\nbool MDynamicAudioNormalizer_PrivateData::reset(void)\n{\n\t//Check audio normalizer status\n\tif(!m_initialized)\n\t{\n\t\tLOG1_ERR(\"Not initialized yet. Must call initialize() first!\");\n\t\treturn false;\n\t}\n\n\tm_delayedSamples = 0;\n\tm_flushBuffer = false;\n\n\tm_buffSrc->reset();\n\tm_buffOut->reset();\n\n\tm_frameBuffer->reset();\n\n\tfor(uint32_t c = 0; c < m_channels; c++)\n\t{\n\t\tm_gainHistory_original[c].clear();\n\t\tm_gainHistory_minimum [c].clear();\n\t\tm_gainHistory_smoothed[c].clear();\n\n\t\tCLEAR_QUEUE(m_loggingData_original[c]);\n\t\tCLEAR_QUEUE(m_loggingData_minimum [c]);\n\t\tCLEAR_QUEUE(m_loggingData_smoothed[c]);\n\n\t\tm_dcCorrectionValue      [c] = 0.0;\n\t\tm_prevAmplificationFactor[c] = 1.0;\n\t\tm_compressThreshold      [c] = 0.0;\n\t}\n\n\treturn true;\n}\n\nbool MDynamicAudioNormalizer::getConfiguration(uint32_t &channels, uint32_t &sampleRate, uint32_t &frameLen, uint32_t &filterSize)\n{\n\ttry\n\t{\n\t\treturn p->getConfiguration(channels, sampleRate, frameLen, filterSize);\n\t}\n\tcatch(std::exception &e)\n\t{\n\t\tLOG1_ERR(e.what());\n\t\treturn false;\n\t}\n}\n\nbool MDynamicAudioNormalizer::getInternalDelay(int64_t &delayInSamples)\n{\n\ttry\n\t{\n\t\treturn p->getInternalDelay(delayInSamples);\n\t}\n\tcatch(std::exception &e)\n\t{\n\t\tLOG1_ERR(e.what());\n\t\treturn false;\n\t}\n}\n\nbool MDynamicAudioNormalizer_PrivateData::getConfiguration(uint32_t &channels, uint32_t &sampleRate, uint32_t &frameLen, uint32_t &filterSize)\n{\n\t//Check audio normalizer status\n\tif(!m_initialized)\n\t{\n\t\tLOG1_ERR(\"Not initialized yet. Must call initialize() first!\");\n\t\treturn false;\n\t}\n\n\tchannels = m_channels;\n\tsampleRate = m_sampleRate;\n\tframeLen = m_frameLen;\n\tfilterSize = m_filterSize;\n\n\treturn true;\n}\n\nbool MDynamicAudioNormalizer_PrivateData::getInternalDelay(int64_t &delayInSamples)\n{\n\t//Check audio normalizer status\n\tif(!m_initialized)\n\t{\n\t\tLOG1_ERR(\"Not initialized yet. Must call initialize() first!\");\n\t\treturn false;\n\t}\n\n\tdelayInSamples = m_delay; //m_frameLen * m_filterSize;\n\treturn true;\n}\n\nbool MDynamicAudioNormalizer::process(const double *const *const samplesIn, double *const *const samplesOut, const int64_t inputSize, int64_t &outputSize)\n{\n\ttry\n\t{\n\t\treturn p->process(samplesIn, samplesOut, inputSize, outputSize, false);\n\t}\n\tcatch (std::exception &e)\n\t{\n\t\tLOG1_ERR(e.what());\n\t\treturn false;\n\t}\n}\n\nbool MDynamicAudioNormalizer::processInplace(double *const *const samplesInOut, const int64_t inputSize, int64_t &outputSize)\n{\n\ttry\n\t{\n\t\treturn p->process(samplesInOut, samplesInOut, inputSize, outputSize, false);\n\t}\n\tcatch(std::exception &e)\n\t{\n\t\tLOG1_ERR(e.what());\n\t\treturn false;\n\t}\n}\n\nbool MDynamicAudioNormalizer_PrivateData::process(const double *const *const samplesIn, double *const *const samplesOut, const int64_t inputSize, int64_t &outputSize, const bool &bFlush)\n{\n\toutputSize = 0;\n\n\t//Check audio normalizer status\n\tif(!m_initialized)\n\t{\n\t\tLOG1_ERR(\"Not initialized yet. Must call initialize() first!\");\n\t\treturn false;\n\t}\n\tif(m_flushBuffer && (!bFlush))\n\t{\n\t\tLOG1_ERR(\"Must not call processInplace() after flushBuffer(). Call reset() first!\");\n\t\treturn false;\n\t}\n\n\tbool bStop = false;\n\n\tuint32_t inputPos = 0;\n\tuint32_t inputSamplesLeft = static_cast<uint32_t>(LIMIT(int64_t(0), inputSize, int64_t(UINT32_MAX)));\n\t\n\tuint32_t outputPos = 0;\n\tuint32_t outputBufferLeft = 0;\n\n\twhile(!bStop)\n\t{\n\t\tbStop = true;\n\n\t\t//Read as many input samples as possible\n\t\twhile((inputSamplesLeft > 0) && (m_buffSrc->samplesLeftPut() > 0))\n\t\t{\n\t\t\tbStop = false;\n\t\t\t\n\t\t\tconst uint32_t copyLen = std::min(inputSamplesLeft, m_buffSrc->samplesLeftPut());\n\t\t\tm_buffSrc->putSamples(samplesIn, inputPos, copyLen);\n\n\t\t\tinputPos         += copyLen;\n\t\t\tinputSamplesLeft -= copyLen;\n\t\t\toutputBufferLeft += copyLen;\n\n\t\t\tif(!bFlush)\n\t\t\t{\n\t\t\t\tm_delayedSamples += copyLen;\n\t\t\t}\n\t\t}\n\n\t\t//Analyze next input frame, if we have enough input\n\t\tif(m_buffSrc->samplesLeftGet() >= m_frameLen)\n\t\t{\n\t\t\tbStop = false;\n\t\t\tanalyzeFrame(m_buffSrc->data());\n\t\t\t\n\t\t\tif(!m_frameBuffer->putFrame(m_buffSrc))\n\t\t\t{\n\t\t\t\tLOG1_ERR(\"Failed to append current input frame to internal buffer!\");\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tm_buffSrc->reset();\n\t\t}\n\n\t\t//Amplify next output frame, if we have enough output\n\t\tif((m_buffOut->samplesLeftPut() >= m_frameLen) && (m_frameBuffer->framesUsed() > 0) && (!m_gainHistory_smoothed[0].empty()))\n\t\t{\n\t\t\tbStop = false;\n\t\t\t\n\t\t\tif(!m_frameBuffer->getFrame(m_buffOut))\n\t\t\t{\n\t\t\t\tLOG1_ERR(\"Failed to retrieve next output frame from internal buffer!\");\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tamplifyFrame(m_buffOut->data());\n\t\t}\n\n\t\t//Write as many output samples as possible\n\t\twhile((outputBufferLeft > 0) && (m_buffOut->samplesLeftGet() > 0) && (bFlush || (m_delayedSamples > m_delay)))\n\t\t{\n\t\t\tbStop = false;\n\n\t\t\tconst uint32_t pending = bFlush ? UINT32_MAX : uint32_t(m_delayedSamples - m_delay);\n\t\t\tconst uint32_t copyLen = std::min(std::min(outputBufferLeft, m_buffOut->samplesLeftGet()), pending);\n\t\t\tm_buffOut->getSamples(samplesOut, outputPos, copyLen);\n\n\t\t\toutputPos        += copyLen;\n\t\t\toutputBufferLeft -= copyLen;\n\t\t\tm_delayedSamples -= copyLen;\n\n\t\t\tif((m_buffOut->samplesLeftGet() < 1) && (m_buffOut->samplesLeftPut() < 1))\n\t\t\t{\n\t\t\t\tm_buffOut->reset();\n\t\t\t}\n\t\t}\n\t}\n\n\toutputSize = int64_t(outputPos);\n\n\tif(inputSamplesLeft > 0)\n\t{\n\t\tLOG1_WRN(\"No all input samples could be processed -> discarding pending input!\");\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\nbool MDynamicAudioNormalizer::flushBuffer(double *const *const samplesOut, const int64_t bufferSize, int64_t &outputSize)\n{\n\ttry\n\t{\n\t\treturn p->flushBuffer(samplesOut, bufferSize, outputSize);\n\t}\n\tcatch(std::exception &e)\n\t{\n\t\tLOG1_ERR(e.what());\n\t\treturn false;\n\t}\n}\n\nbool MDynamicAudioNormalizer_PrivateData::flushBuffer(double *const *const samplesOut, const int64_t bufferSize, int64_t &outputSize)\n{\n\toutputSize = 0;\n\n\t//Check audio normalizer status\n\tif(!m_initialized)\n\t{\n\t\tLOG1_ERR(\"Not initialized yet. Must call initialize() first!\");\n\t\treturn false;\n\t}\n\n\tm_flushBuffer = true;\n\tconst uint32_t pendingSamples = static_cast<uint32_t>(LIMIT(int64_t(0), std::min(m_delayedSamples, bufferSize), int64_t(UINT32_MAX)));\n\n\tif(pendingSamples < 1)\n\t{\n\t\treturn true; /*no pending samples left*/\n\t}\n\n\tbool success = false;\n\tdo\n\t{\n\t\tfor(uint32_t c = 0; c < m_channels; c++)\n\t\t{\n\t\t\tfor(uint32_t i = 0; i < pendingSamples; i++)\n\t\t\t{\n\t\t\t\tsamplesOut[c][i] = m_altBoundaryMode ? DBL_EPSILON : ((m_targetRms > DBL_EPSILON) ? std::min(m_peakValue, m_targetRms) : m_peakValue);\n\t\t\t\tif(m_enableDCCorrection)\n\t\t\t\t{\n\t\t\t\t\tsamplesOut[c][i] *= ((i % 2) == 1) ? (-1) : 1;\n\t\t\t\t\tsamplesOut[c][i] += m_dcCorrectionValue[c];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tsuccess = process(samplesOut, samplesOut, pendingSamples, outputSize, true);\n\t}\n\twhile(success && (outputSize <= 0));\n\t\n\treturn success;\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Public Static Functions\n///////////////////////////////////////////////////////////////////////////////\n\nvoid MDynamicAudioNormalizer::getVersionInfo(uint32_t &major, uint32_t &minor,uint32_t &patch)\n{\n\tmajor = DYNAUDNORM_NS::VERSION_MAJOR;\n\tminor = DYNAUDNORM_NS::VERSION_MINOR;\n\tpatch = DYNAUDNORM_NS::VERSION_PATCH;\n}\n\nvoid MDynamicAudioNormalizer::getBuildInfo(const char **const date, const char **const time, const char **const compiler, const char **const arch, bool &debug)\n{\n\t*date     = DYNAUDNORM_NS::BUILD_DATE;\n\t*time     = DYNAUDNORM_NS::BUILD_TIME;\n\t*compiler = DYNAUDNORM_NS::BUILD_COMPILER;\n\t*arch     = DYNAUDNORM_NS::BUILD_ARCH;\n\tdebug     = bool(DYNAUDNORM_DEBUG);\n}\n\nMDynamicAudioNormalizer::LogFunction *MDynamicAudioNormalizer::setLogFunction(MDynamicAudioNormalizer::LogFunction *const logFunction)\n{\n\treturn DYNAUDNORM_NS::setLoggingHandler(logFunction);\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Procesing Functions\n///////////////////////////////////////////////////////////////////////////////\n\nvoid MDynamicAudioNormalizer_PrivateData::analyzeFrame(DYNAUDNORM_NS::FrameData *const frame)\n{\n\t//Perform DC Correction (optional)\n\tif(m_enableDCCorrection)\n\t{\n\t\tperfromDCCorrection(frame, m_gainHistory_original[0].empty());\n\t}\n\n\t//Perform compression (optional)\n\tif(m_compressFactor > DBL_EPSILON)\n\t{\n\t\tperfromCompression(frame, m_gainHistory_original[0].empty());\n\t}\n\n\t//Find the frame's peak sample value\n\tif(m_channelsCoupled)\n\t{\n\t\tconst double currentGainFactor = getMaxLocalGain(frame);\n\t\tfor(uint32_t c = 0; c < m_channels; c++)\n\t\t{\n\t\t\tupdateGainHistory(c, currentGainFactor);\n\t\t}\n\t}\n\telse\n\t{\n\t\tfor(uint32_t c = 0; c < m_channels; c++)\n\t\t{\n\t\t\tupdateGainHistory(c, getMaxLocalGain(frame, c));\n\t\t}\n\t}\n\n\t//Write data to the log file\n\twriteLogFile();\n}\n\nvoid MDynamicAudioNormalizer_PrivateData::amplifyFrame(DYNAUDNORM_NS::FrameData *const frame)\n{\n\tfor(uint32_t c = 0; c < m_channels; c++)\n\t{\n\t\tif(m_gainHistory_smoothed[c].empty())\n\t\t{\n\t\t\tLOG1_WRN(\"There are no information available for the current frame!\");\n\t\t\tbreak;\n\t\t}\n\n\t\tdouble *const dataPtr = frame->data(c);\n\t\tconst double currAmplificationFactor = m_gainHistory_smoothed[c].front();\n\t\tm_gainHistory_smoothed[c].pop_front();\n\n\t\tfor(uint32_t i = 0; i < m_frameLen; i++)\n\t\t{\n\t\t\tconst double amplificationFactor = FADE(m_prevAmplificationFactor[c], currAmplificationFactor, i, m_fadeFactors);\n\t\t\tdataPtr[i] *= amplificationFactor;\n\t\t\tLOG_VALUE(amplificationFactor, m_prevAmplificationFactor[c], currAmplificationFactor, nextAmplificationFactor, c, i);\n\t\t\tif(fabs(dataPtr[i]) > m_peakValue)\n\t\t\t{\n\t\t\t\tm_sampleCounterClips++;\n\t\t\t\tdataPtr[i] = copysign(m_peakValue, dataPtr[i]); /*fix rare clipping*/\n\t\t\t}\n\t\t}\n\t\t\n\t\tm_prevAmplificationFactor[c] = currAmplificationFactor;\n\t\tm_sampleCounterTotal += m_frameLen;\n\t}\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Helper Functions\n///////////////////////////////////////////////////////////////////////////////\n\ndouble MDynamicAudioNormalizer_PrivateData::getMaxLocalGain(DYNAUDNORM_NS::FrameData *const frame, const uint32_t channel)\n{\n\tconst double maximumGain = m_peakValue / findPeakMagnitude(frame, channel);\n\tconst double rmsGain = (m_targetRms > DBL_EPSILON) ? (m_targetRms / computeFrameRMS(frame, channel)) : DBL_MAX;\n\treturn BOUND(m_maxAmplification, std::min(maximumGain, rmsGain));\n}\n\ndouble MDynamicAudioNormalizer_PrivateData::findPeakMagnitude(DYNAUDNORM_NS::FrameData *const frame, const uint32_t channel)\n{\n\tdouble dMax = DBL_EPSILON;\n\n\tif (channel == UINT32_MAX)\n\t{\n\t\tfor (uint32_t c = 0; c < m_channels; c++)\n\t\t{\n\t\t\tdouble *const dataPtr = frame->data(c);\n\t\t\tfor (uint32_t i = 0; i < m_frameLen; i++)\n\t\t\t{\n\t\t\t\tUPDATE_MAX(dMax, fabs(dataPtr[i]));\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tdouble *const dataPtr = frame->data(channel);\n\t\tfor (uint32_t i = 0; i < m_frameLen; i++)\n\t\t{\n\t\t\tUPDATE_MAX(dMax, fabs(dataPtr[i]));\n\t\t}\n\t}\n\n\treturn dMax;\n}\n\ndouble MDynamicAudioNormalizer_PrivateData::computeFrameRMS(const DYNAUDNORM_NS::FrameData *const frame, const uint32_t channel)\n{\n\tdouble rmsValue = 0.0;\n\t\n\tif(channel == UINT32_MAX)\n\t{\n\t\tfor(uint32_t c = 0; c < m_channels; c++)\n\t\t{\n\t\t\tconst double *dataPtr = frame->data(c);\n\t\t\tfor(uint32_t i = 0; i < m_frameLen; i++)\n\t\t\t{\n\t\t\t\trmsValue += POW2(dataPtr[i]);\n\t\t\t}\n\t\t}\n\t\trmsValue /= double(m_frameLen * m_channels);\n\t}\n\telse\n\t{\n\t\tconst double *dataPtr = frame->data(channel);\n\t\tfor(uint32_t i = 0; i < m_frameLen; i++)\n\t\t{\n\t\t\trmsValue += POW2(dataPtr[i]);\n\t\t}\n\t\trmsValue /= double(m_frameLen);\n\t}\n\n\treturn std::max(sqrt(rmsValue), DBL_EPSILON);\n}\n\ndouble MDynamicAudioNormalizer_PrivateData::computeFrameStdDev(const DYNAUDNORM_NS::FrameData *const frame, const uint32_t channel)\n{\n\tdouble variance = 0.0;\n\n\tif(channel == UINT32_MAX)\n\t{\n\t\tfor(uint32_t c = 0; c < m_channels; c++)\n\t\t{\n\t\t\tconst double *dataPtr = frame->data(c);\n\t\t\tfor(uint32_t i = 0; i < m_frameLen; i++)\n\t\t\t{\n\t\t\t\tvariance += POW2(dataPtr[i]);\t//Assume that MEAN is *zero*\n\t\t\t}\n\t\t}\n\t\tvariance /= double((m_channels * m_frameLen) - 1);\n\t}\n\telse\n\t{\n\t\tconst double *dataPtr = frame->data(channel);\n\t\tfor(uint32_t i = 0; i < m_frameLen; i++)\n\t\t{\n\t\t\tvariance += POW2(dataPtr[i]);\t//Assume that MEAN is *zero*\n\t\t}\n\t\tvariance /= double(m_frameLen - 1);\n\t}\n\n\n\treturn std::max(sqrt(variance), DBL_EPSILON);\n}\n\nvoid MDynamicAudioNormalizer_PrivateData::updateGainHistory(const uint32_t &channel, const double &currentGainFactor)\n{\n\t//Pre-fill the gain history\n\tif(m_gainHistory_original[channel].empty() || m_gainHistory_minimum[channel].empty())\n\t{\n\t\tconst double initial_value = m_altBoundaryMode ? currentGainFactor : 1.0;\n\t\tm_prevAmplificationFactor[channel] = initial_value;\n\t\twhile(m_gainHistory_original[channel].size() < m_prefillLen)\n\t\t{\n\t\t\tm_gainHistory_original[channel].push_back(initial_value);\n\t\t}\n\t}\n\n\t//Insert current gain factor\n\tm_gainHistory_original[channel].push_back(currentGainFactor);\n\tm_loggingData_original[channel].push     (currentGainFactor);\n\n\t//Apply the minimum filter\n\twhile(m_gainHistory_original[channel].size() >= m_filterSize)\n\t{\n\t\tassert(m_gainHistory_original[channel].size() == m_filterSize);\n\t\tif (m_gainHistory_minimum[channel].empty())\n\t\t{\n\t\t\tdouble initial_value = m_altBoundaryMode ? m_gainHistory_original[channel].front() : 1.0;\n\t\t\tstd::deque<double>::const_iterator input = m_gainHistory_original[channel].begin() + m_prefillLen;\n\t\t\twhile (m_gainHistory_minimum[channel].size() < m_prefillLen)\n\t\t\t{\n\t\t\t\tinitial_value = std::min(initial_value, *(++input));\n\t\t\t\tm_gainHistory_minimum[channel].push_back(initial_value);\n\t\t\t}\n\t\t}\n\t\tconst double minimum = *std::min_element(m_gainHistory_original[channel].begin(), m_gainHistory_original[channel].end());\n\t\tm_gainHistory_original[channel].pop_front();\n\t\tm_gainHistory_minimum[channel].push_back(minimum);\n\t\tm_loggingData_minimum[channel].push(minimum);\n\t}\n\n\t//Apply the Gaussian filter\n\twhile(m_gainHistory_minimum[channel].size() >= m_filterSize)\n\t{\n\t\tassert(m_gainHistory_minimum[channel].size() == m_filterSize);\n\t\tconst double smoothed = m_gaussianFilter->apply(m_gainHistory_minimum[channel]);\n\t\tm_gainHistory_minimum[channel].pop_front();\n\t\tm_gainHistory_smoothed[channel].push_back(smoothed);\n\t\tm_loggingData_smoothed[channel].push(smoothed);\n\t}\n}\n\nvoid MDynamicAudioNormalizer_PrivateData::perfromDCCorrection(DYNAUDNORM_NS::FrameData *const frame, const bool &isFirstFrame)\n{\n\tconst double diff = 1.0 / double(m_frameLen);\n\n\tfor(uint32_t c = 0; c < m_channels; c++)\n\t{\n\t\tdouble *const dataPtr = frame->data(c);\n\t\tdouble currentAverageValue = 0.0;\n\n\t\tfor(uint32_t i = 0; i < m_frameLen; i++)\n\t\t{\n\t\t\tcurrentAverageValue += (dataPtr[i] * diff);\n\t\t}\n\n\t\tconst double prevValue = isFirstFrame ? currentAverageValue : m_dcCorrectionValue[c];\n\t\tm_dcCorrectionValue[c] = isFirstFrame ? currentAverageValue : UPDATE_VALUE(currentAverageValue, m_dcCorrectionValue[c], 0.1);\n\n\t\tfor(uint32_t i = 0; i < m_frameLen; i++)\n\t\t{\n\t\t\tdataPtr[i] -= FADE(prevValue, m_dcCorrectionValue[c], i, m_fadeFactors);\n\t\t}\n\t}\n}\n\nvoid MDynamicAudioNormalizer_PrivateData::perfromCompression(DYNAUDNORM_NS::FrameData *const frame, const bool &isFirstFrame)\n{\n\tif(m_channelsCoupled)\n\t{\n\t\tconst double standardDeviation = computeFrameStdDev(frame);\n\t\tconst double currentThreshold  = std::min(1.0, m_compressFactor * standardDeviation);\n\n\t\tconst double prevValue = isFirstFrame ? currentThreshold : m_compressThreshold[0];\n\t\tm_compressThreshold[0] = isFirstFrame ? currentThreshold : UPDATE_VALUE(currentThreshold, m_compressThreshold[0], (1.0/3.0));\n\n\t\tconst double prevActualThresh = setupCompressThresh(prevValue);\n\t\tconst double currActualThresh = setupCompressThresh(m_compressThreshold[0]);\n\n\t\tfor(uint32_t c = 0; c < m_channels; c++)\n\t\t{\n\t\t\tdouble *const dataPtr = frame->data(c);\n\t\t\tfor(uint32_t i = 0; i < m_frameLen; i++)\n\t\t\t{\n\t\t\t\tconst double localThresh = FADE(prevActualThresh, currActualThresh, i, m_fadeFactors);\n\t\t\t\tdataPtr[i] = copysign(BOUND(localThresh, fabs(dataPtr[i])), dataPtr[i]);\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tfor(uint32_t c = 0; c < m_channels; c++)\n\t\t{\n\t\t\tconst double standardDeviation = computeFrameStdDev(frame, c);\n\t\t\tconst double currentThreshold  = setupCompressThresh(std::min(1.0,m_compressFactor * standardDeviation));\n\n\t\t\tconst double prevValue = isFirstFrame ? currentThreshold : m_compressThreshold[c];\n\t\t\tm_compressThreshold[c] = isFirstFrame ? currentThreshold : UPDATE_VALUE(currentThreshold, m_compressThreshold[c], (1.0/3.0));\n\n\t\t\tconst double prevActualThresh = setupCompressThresh(prevValue);\n\t\t\tconst double currActualThresh = setupCompressThresh(m_compressThreshold[c]);\n\n\t\t\tdouble *const dataPtr = frame->data(c);\n\t\t\tfor(uint32_t i = 0; i < m_frameLen; i++)\n\t\t\t{\n\t\t\t\tconst double localThresh = FADE(prevActualThresh, currActualThresh, i, m_fadeFactors);\n\t\t\t\tdataPtr[i] = copysign(BOUND(localThresh, fabs(dataPtr[i])), dataPtr[i]);\n\t\t\t}\n\t\t}\n\t}\n}\n\nvoid MDynamicAudioNormalizer_PrivateData::writeLogFile(void)\n{\n\tbool bIsEmpty = false;\n\tfor (uint32_t c = 0; c < m_channels; c++)\n\t{\n\t\tbIsEmpty = bIsEmpty || m_loggingData_original[c].empty() || m_loggingData_minimum[c].empty() || m_loggingData_smoothed[c].empty();\n\t}\n\n\twhile (!bIsEmpty)\n\t{\n\t\tfor (uint32_t c = 0; c < m_channels; c++)\n\t\t{\n\t\t\tif (m_logFile && (ferror(m_logFile) == 0))\n\t\t\t{\n\t\t\t\tif (c > 0)\n\t\t\t\t{\n\t\t\t\t\tfprintf(m_logFile, \"\\t\\t\");\n\t\t\t\t}\n\t\t\t\tfprintf(m_logFile, \"%.5f\\t%.5f\\t%.5f\", m_loggingData_original[c].front(), m_loggingData_minimum[c].front(), m_loggingData_smoothed[c].front());\n\t\t\t}\n\t\t\tm_loggingData_original[c].pop();\n\t\t\tm_loggingData_minimum[c].pop();\n\t\t\tm_loggingData_smoothed[c].pop();\n\t\t\tbIsEmpty = bIsEmpty || m_loggingData_original[c].empty() || m_loggingData_minimum[c].empty() || m_loggingData_smoothed[c].empty();\n\t\t}\n\t\tif (m_logFile && (ferror(m_logFile) == 0))\n\t\t{\n\t\t\tfprintf(m_logFile, \"\\n\");\n\t\t}\n\t}\n\n\tif(m_logFile && (ferror(m_logFile) != 0))\n\t{\n\t\tif(ferror(m_logFile) != 0)\n\t\t{\n\t\t\tLOG1_WRN(\"Error while writing to log file. No further logging output will be created.\");\n\t\t}\n\t}\n}\n\nvoid MDynamicAudioNormalizer_PrivateData::printParameters(void)\n{\n\tLOG1_DBG(\"------- DynamicAudioNormalizer -------\");\n\tLOG2_DBG(\"Lib Version          : %u.%02u-%u\", DYNAUDNORM_NS::VERSION_MAJOR, DYNAUDNORM_NS::VERSION_MINOR , DYNAUDNORM_NS::VERSION_PATCH);\n\tLOG2_DBG(\"m_channels           : %u\",         m_channels);\n\tLOG2_DBG(\"m_sampleRate         : %u\",         m_sampleRate);\n\tLOG2_DBG(\"m_frameLen           : %u\",         m_frameLen);\n\tLOG2_DBG(\"m_filterSize         : %u\",         m_filterSize);\n\tLOG2_DBG(\"m_peakValue          : %.4f\",       m_peakValue);\n\tLOG2_DBG(\"m_maxAmplification   : %.4f\",       m_maxAmplification);\n\tLOG2_DBG(\"m_targetRms          : %.4f\",       m_targetRms);\n\tLOG2_DBG(\"m_compressFactor     : %.4f\",       m_compressFactor);\n\tLOG2_DBG(\"m_channelsCoupled    : %s\",         BOOLIFY(m_channelsCoupled));\n\tLOG2_DBG(\"m_enableDCCorrection : %s\",         BOOLIFY(m_enableDCCorrection));\n\tLOG2_DBG(\"m_altBoundaryMode    : %s\",         BOOLIFY(m_altBoundaryMode));\n\tLOG1_DBG(\"------- DynamicAudioNormalizer -------\");\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Static Utility Functions\n///////////////////////////////////////////////////////////////////////////////\n\nvoid MDynamicAudioNormalizer_PrivateData::precalculateFadeFactors(double *const fadeFactors[2], const uint32_t frameLen)\n{\n\tassert((frameLen > 0) && ((frameLen % 2) == 0));\n\tconst double dStepSize = 1.0 / double(frameLen);\n\n\tfor(uint32_t pos = 0; pos < frameLen; pos++)\n\t{\n\t\tfadeFactors[0][pos] = 1.0 - (dStepSize * double(pos + 1U));\n\t\tfadeFactors[1][pos] = 1.0 - fadeFactors[0][pos];\n\t}\n\n\t//for(uint32_t pos = 0; pos < frameLen; pos++)\n\t//{\n\t//\tLOG2_DBG(\"%.8f %.8f %.8f\", fadeFactors[0][pos], fadeFactors[1][pos], fadeFactors[0][pos] + fadeFactors[1][pos]);\n\t//}\n}\n\ndouble MDynamicAudioNormalizer_PrivateData::setupCompressThresh(const double &dThreshold)\n{\n\tif((dThreshold > DBL_EPSILON) && (dThreshold < (1.0 - DBL_EPSILON)))\n\t{\n\t\tdouble dCurrentThreshold = dThreshold;\n\t\tdouble dStepSize = 1.0;\n\t\twhile(dStepSize > DBL_EPSILON)\n\t\t{\n\t\t\twhile((dCurrentThreshold + dStepSize > dCurrentThreshold) && (BOUND(dCurrentThreshold + dStepSize, 1.0) <= dThreshold))\n\t\t\t{\n\t\t\t\tdCurrentThreshold += dStepSize;\n\t\t\t}\n\t\t\tdStepSize /= 2.0;\n\t\t}\n\t\treturn dCurrentThreshold;\n\t}\n\telse\n\t{\n\t\treturn dThreshold;\n\t}\n}\n"
  },
  {
    "path": "DynamicAudioNormalizerAPI/src/FrameBuffer.cpp",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Library\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This library is free software; you can redistribute it and/or\n// modify it under the terms of the GNU Lesser General Public\n// License as published by the Free Software Foundation; either\n// version 2.1 of the License, or (at your option) any later version.\n//\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public\n// License along with this library; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n//\n// http://www.gnu.org/licenses/lgpl-2.1.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#include \"FrameBuffer.h\"\n\n///////////////////////////////////////////////////////////////////////////////\n// Frame Data\n///////////////////////////////////////////////////////////////////////////////\n\nDYNAUDNORM_NS::FrameData::FrameData(const uint32_t &channels, const uint32_t &frameLength)\n:\n\tm_channels(channels),\n\tm_frameLength(frameLength)\n{\n\tm_data = new double*[m_channels];\n\n\tfor(uint32_t c = 0; c < m_channels; c++)\n\t{\n\t\tm_data[c] = new double[m_frameLength];\n\t}\n\n\tclear();\n}\n\nDYNAUDNORM_NS::FrameData::~FrameData(void)\n{\n\tfor(uint32_t c = 0; c < m_channels; c++)\n\t{\n\t\tMY_DELETE_ARRAY(m_data[c]);\n\t}\n\n\tMY_DELETE_ARRAY(m_data);\n}\n\nvoid DYNAUDNORM_NS::FrameData::clear(void)\n{\n\tfor(uint32_t c = 0; c < m_channels; c++)\n\t{\n\t\tmemset(m_data[c], 0, m_frameLength * sizeof(double));\n\t}\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Frame FIFO\n///////////////////////////////////////////////////////////////////////////////\n\nDYNAUDNORM_NS::FrameFIFO::FrameFIFO(const uint32_t &channels, const uint32_t &frameLength)\n{\n\tm_data = new DYNAUDNORM_NS::FrameData(channels, frameLength);\n\treset(false);\n}\n\nDYNAUDNORM_NS::FrameFIFO::~FrameFIFO(void)\n{\n\tMY_DELETE(m_data);\n}\n\nvoid DYNAUDNORM_NS::FrameFIFO::reset(const bool &bForceClear)\n{\n\tif(bForceClear) m_data->clear();\n\tm_posPut = m_posGet = m_leftGet = 0;\n\tm_leftPut = m_data->frameLength();\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Constructor & Destructor\n///////////////////////////////////////////////////////////////////////////////\n\nDYNAUDNORM_NS::FrameBuffer::FrameBuffer(const uint32_t &channels, const uint32_t &frameLength, const uint32_t &frameCount)\n:\n\tm_channels(channels),\n\tm_frameLength(frameLength),\n\tm_frameCount(frameCount)\n{\n\tm_framesFree = m_frameCount;\n\tm_framesUsed = 0;\n\tm_posPut = m_posGet = 0;\n\n\tm_frames = new DYNAUDNORM_NS::FrameData*[m_frameCount];\n\n\tfor(uint32_t i = 0; i < m_frameCount; i++)\n\t{\n\t\tm_frames[i] = new DYNAUDNORM_NS::FrameData(m_channels, m_frameLength);\n\t}\n}\n\nDYNAUDNORM_NS::FrameBuffer::~FrameBuffer(void)\n{\n\tfor(uint32_t i = 0; i < m_frameCount; i++)\n\t{\n\t\tMY_DELETE(m_frames[i]);\n\t}\n\n\tMY_DELETE_ARRAY(m_frames);\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Reset\n///////////////////////////////////////////////////////////////////////////////\n\nvoid DYNAUDNORM_NS::FrameBuffer::reset(void)\n{\n\tm_framesFree = m_frameCount;\n\tm_framesUsed = 0;\n\tm_posPut = m_posGet = 0;\n\n\tfor(uint32_t i = 0; i < m_frameCount; i++)\n\t{\n\t\tm_frames[i]->clear();\n\t}\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Put / Get Frame\n///////////////////////////////////////////////////////////////////////////////\n\nbool DYNAUDNORM_NS::FrameBuffer::putFrame(DYNAUDNORM_NS::FrameFIFO *const src)\n{\n\tif((m_framesFree < 1) && (src->samplesLeftGet() < m_frameLength))\n\t{\n\t\treturn false;\n\t}\n\n\tsrc->getSamples(m_frames[m_posPut], 0, m_frameLength);\n\tm_posPut = ((m_posPut + 1) % m_frameCount);\n\t\n\tm_framesUsed++;\n\tm_framesFree--;\n\n\treturn true;\n}\n\nbool DYNAUDNORM_NS::FrameBuffer::getFrame(DYNAUDNORM_NS::FrameFIFO *const dest)\n{\n\tif((m_framesUsed < 1) && (dest->samplesLeftPut() < m_frameLength))\n\t{\n\t\treturn false;\n\t}\n\n\tdest->putSamples(m_frames[m_posGet], 0, m_frameLength);\n\tm_posGet = ((m_posGet + 1) % m_frameCount);\n\t\n\tm_framesUsed--;\n\tm_framesFree++;\n\n\treturn true;\n}\n"
  },
  {
    "path": "DynamicAudioNormalizerAPI/src/FrameBuffer.h",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Library\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This library is free software; you can redistribute it and/or\n// modify it under the terms of the GNU Lesser General Public\n// License as published by the Free Software Foundation; either\n// version 2.1 of the License, or (at your option) any later version.\n//\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public\n// License along with this library; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n//\n// http://www.gnu.org/licenses/lgpl-2.1.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#pragma once\n\n#include \"Common.h\"\n#include <cassert>\n#include <cstring>\n#include <stdint.h>\n\nnamespace DYNAUDNORM_NS\n{\n\tclass FrameData\n\t{\n\tpublic:\n\t\tFrameData(const uint32_t &channels, const uint32_t &frameLength);\n\t\t~FrameData(void);\n\n\t\tinline double *data(const uint32_t &channel)\n\t\t{\n\t\t\tassert(channel < m_channels);\n\t\t\treturn m_data[channel];\n\t\t}\n\n\t\tinline const double *data(const uint32_t &channel) const\n\t\t{\n\t\t\tassert(channel < m_channels);\n\t\t\treturn m_data[channel];\n\t\t}\n\n\t\tinline const uint32_t &channels(void) { return m_channels; }\n\t\tinline const uint32_t &frameLength(void) { return m_frameLength; }\n\n\t\tinline void write(const double *const *const src, const uint32_t &srcOffset, const uint32_t &destOffset, const uint32_t &length)\n\t\t{\n\t\t\tassert(length + destOffset <= m_frameLength);\n\t\t\tfor (uint32_t c = 0; c < m_channels; c++)\n\t\t\t{\n\t\t\t\tmemcpy(&m_data[c][destOffset], &src[c][srcOffset], length * sizeof(double));\n\t\t\t}\n\t\t}\n\n\t\tinline void write(const FrameData *const src, const uint32_t &srcOffset, const uint32_t &destOffset, const uint32_t &length)\n\t\t{\n\t\t\tassert(length + destOffset <= m_frameLength);\n\t\t\tfor (uint32_t c = 0; c < m_channels; c++)\n\t\t\t{\n\t\t\t\tmemcpy(&m_data[c][destOffset], &src->data(c)[srcOffset], length * sizeof(double));\n\t\t\t}\n\t\t}\n\n\t\tinline void read(double *const *const dest, const uint32_t &destOffset, const uint32_t &srcOffset, const uint32_t &length)\n\t\t{\n\t\t\tassert(length + srcOffset <= m_frameLength);\n\t\t\tfor (uint32_t c = 0; c < m_channels; c++)\n\t\t\t{\n\t\t\t\tmemcpy(&dest[c][destOffset], &m_data[c][srcOffset], length * sizeof(double));\n\t\t\t}\n\t\t}\n\n\t\tinline void read(FrameData *const dest, const uint32_t &destOffset, const uint32_t &srcOffset, const uint32_t &length)\n\t\t{\n\t\t\tassert(length + srcOffset <= m_frameLength);\n\t\t\tfor (uint32_t c = 0; c < m_channels; c++)\n\t\t\t{\n\t\t\t\tmemcpy(&dest->data(c)[destOffset], &m_data[c][srcOffset], length * sizeof(double));\n\t\t\t}\n\t\t}\n\n\t\tvoid clear(void);\n\n\tprivate:\n\t\tFrameData(const FrameData&) : m_channels(0), m_frameLength(0) { throw \"unsupported\"; }\n\t\tFrameData &operator=(const FrameData&) { throw \"unsupported\"; }\n\n\t\tconst uint32_t m_channels;\n\t\tconst uint32_t m_frameLength;\n\n\t\tdouble **m_data;\n\t};\n\n\tclass FrameFIFO\n\t{\n\tpublic:\n\t\tFrameFIFO(const uint32_t &channels, const uint32_t &frameLength);\n\t\t~FrameFIFO(void);\n\n\t\tinline uint32_t samplesLeftPut(void) { return m_leftPut; }\n\t\tinline uint32_t samplesLeftGet(void) { return m_leftGet; }\n\n\t\tinline void putSamples(const double *const *const src, const uint32_t &srcOffset, const uint32_t &length)\n\t\t{\n\t\t\tassert(length <= samplesLeftPut());\n\t\t\tm_data->write(src, srcOffset, m_posPut, length);\n\t\t\tm_posPut += length;\n\t\t\tm_leftPut -= length;\n\t\t\tm_leftGet += length;\n\t\t}\n\n\t\tinline void putSamples(const FrameData *const src, const uint32_t &srcOffset, const uint32_t &length)\n\t\t{\n\t\t\tassert(length <= samplesLeftPut());\n\t\t\tm_data->write(src, srcOffset, m_posPut, length);\n\t\t\tm_posPut += length;\n\t\t\tm_leftPut -= length;\n\t\t\tm_leftGet += length;\n\t\t}\n\n\t\tinline void getSamples(double *const *const dest, const uint32_t &destOffset, const uint32_t &length)\n\t\t{\n\t\t\tassert(length <= samplesLeftGet());\n\t\t\tm_data->read(dest, destOffset, m_posGet, length);\n\t\t\tm_posGet += length;\n\t\t\tm_leftGet -= length;\n\t\t}\n\n\t\tinline void getSamples(FrameData *const dest, const uint32_t &destOffset, const uint32_t &length)\n\t\t{\n\t\t\tassert(length <= samplesLeftGet());\n\t\t\tm_data->read(dest, destOffset, m_posGet, length);\n\t\t\tm_posGet += length;\n\t\t\tm_leftGet -= length;\n\t\t}\n\n\t\tinline FrameData *data(void)\n\t\t{\n\t\t\treturn m_data;\n\t\t}\n\n\t\tvoid reset(const bool &bForceClear = true);\n\n\tprivate:\n\t\tFrameData *m_data;\n\n\t\tuint32_t m_posPut;\n\t\tuint32_t m_posGet;\n\t\tuint32_t m_leftPut;\n\t\tuint32_t m_leftGet;\n\t};\n\n\tclass FrameBuffer\n\t{\n\tpublic:\n\t\tFrameBuffer(const uint32_t &channels, const uint32_t &frameLength, const uint32_t &frameCount);\n\t\t~FrameBuffer(void);\n\n\t\tbool putFrame(FrameFIFO *const src);\n\t\tbool getFrame(FrameFIFO *const dest);\n\n\t\tinline const uint32_t &channels(void) { return m_channels; }\n\t\tinline const uint32_t &frameLength(void) { return m_frameLength; }\n\t\tinline const uint32_t &frameCount(void) { return m_frameCount; }\n\n\t\tinline const uint32_t &framesFree(void) { return m_framesFree; }\n\t\tinline const uint32_t &framesUsed(void) { return m_framesUsed; }\n\n\t\tvoid reset(void);\n\n\tprivate:\n\t\tFrameBuffer(const FrameBuffer&) : m_channels(0), m_frameLength(0), m_frameCount(0) { throw \"unsupported\"; }\n\t\tFrameBuffer &operator=(const FrameBuffer&) { throw \"unsupported\"; }\n\n\t\tconst uint32_t m_channels;\n\t\tconst uint32_t m_frameLength;\n\t\tconst uint32_t m_frameCount;\n\n\t\tuint32_t m_framesFree;\n\t\tuint32_t m_framesUsed;\n\n\t\tuint32_t m_posPut;\n\t\tuint32_t m_posGet;\n\n\t\tFrameData **m_frames;\n\t};\n}\n"
  },
  {
    "path": "DynamicAudioNormalizerAPI/src/GaussianFilter.cpp",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Library\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This library is free software; you can redistribute it and/or\n// modify it under the terms of the GNU Lesser General Public\n// License as published by the Free Software Foundation; either\n// version 2.1 of the License, or (at your option) any later version.\n//\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public\n// License along with this library; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n//\n// http://www.gnu.org/licenses/lgpl-2.1.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#include \"GaussianFilter.h\"\n\n#include \"Common.h\"\n\n#include <cmath>\n#include <cstring>\n#include <stdexcept>\n\nstatic const double s_pi = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679;\n\n///////////////////////////////////////////////////////////////////////////////\n// Constructor & Destructor\n///////////////////////////////////////////////////////////////////////////////\n\nDYNAUDNORM_NS::GaussianFilter::GaussianFilter(const uint32_t &filterSize, const double &sigma)\n:\n\tm_filterSize(filterSize)\n{\n\tif((filterSize < 1) || ((filterSize % 2) != 1))\n\t{\n\t\tthrow std::runtime_error(\"Filter size must be a positive and odd value!\");\n\t}\n\t\n\t//Allocate weights\n\tm_weights = new double[filterSize];\n\tdouble totalWeight = 0.0;\n\n\t//Pre-computer constants\n\tconst uint32_t offset = m_filterSize / 2;\n\tconst double c1 = 1.0 / (sigma * sqrt(2.0 * s_pi));\n\tconst double c2 = 2.0 * pow(sigma, 2.0);\n\n\t//Compute weights\n\tfor(uint32_t i = 0; i < m_filterSize; i++)\n\t{\n\t\tconst int32_t x = int32_t(i) - int32_t(offset);\n\t\tm_weights[i] = c1 * exp(-(pow(x, 2.0) / c2));\n\t\ttotalWeight += m_weights[i];\n\t}\n\n\t//Adjust weights\n\tconst double adjust = 1.0 / totalWeight;\n\tfor(uint32_t i = 0; i < m_filterSize; i++)\n\t{\n\t\tm_weights[i] *= adjust;\n\t\t//LOG_WRN(TXT(\"Gauss Weight %02u = %.4f\"), i, m_weights[i]);\n\t}\n}\n\nDYNAUDNORM_NS::GaussianFilter::~GaussianFilter(void)\n{\n\tMY_DELETE_ARRAY(m_weights);\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Apply Filter\n///////////////////////////////////////////////////////////////////////////////\n\ndouble DYNAUDNORM_NS::GaussianFilter::apply(const std::deque<double> &values)\n{\n\tif(values.size() != m_filterSize)\n\t{\n\t\tthrow std::runtime_error(\"Input data has the wrong size!\");\n\t}\n\t\n\tuint32_t w = 0;\n\tdouble result = 0.0;\n\n\t//Apply Gaussian filter\n\tfor(std::deque<double>::const_iterator iter = values.begin(); iter != values.end(); iter++)\n\t{\n\t\tresult += (*iter) * m_weights[w++];\n\t}\n\n\treturn result;\n}\n"
  },
  {
    "path": "DynamicAudioNormalizerAPI/src/GaussianFilter.h",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Library\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This library is free software; you can redistribute it and/or\n// modify it under the terms of the GNU Lesser General Public\n// License as published by the Free Software Foundation; either\n// version 2.1 of the License, or (at your option) any later version.\n//\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public\n// License along with this library; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n//\n// http://www.gnu.org/licenses/lgpl-2.1.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#pragma once\n\n#include \"Common.h\"\n#include <cstdlib>\n#include <stdint.h>\n#include <deque>\n\nnamespace DYNAUDNORM_NS\n{\n\tclass GaussianFilter\n\t{\n\tpublic:\n\t\tGaussianFilter(const uint32_t &filterSize, const double &sigma);\n\t\tvirtual ~GaussianFilter(void);\n\n\t\tdouble apply(const std::deque<double> &values);\n\n\tprivate:\n\t\tconst uint32_t m_filterSize;\n\t\tdouble *m_weights;\n\n\t\tGaussianFilter &operator=(const GaussianFilter &) { throw 666; }\n\t};\n}\n"
  },
  {
    "path": "DynamicAudioNormalizerAPI/src/Logging.cpp",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Library\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This library is free software; you can redistribute it and/or\n// modify it under the terms of the GNU Lesser General Public\n// License as published by the Free Software Foundation; either\n// version 2.1 of the License, or (at your option) any later version.\n//\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public\n// License along with this library; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n//\n// http://www.gnu.org/licenses/lgpl-2.1.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#include \"Logging.h\"\n\n#ifdef _MSC_VER\n#define _CRT_SECURE_NO_WARNINGS\n#endif\n\n//Internal\n#include <Threads.h>\n\n//Stdlib\n#include <cstdlib>\n#include <cstdio>\n#include <cstdarg>\n\n//Globals\nstatic MY_CRITSEC_INIT(g_mutex);\nstatic DYNAUDNORM_NS::LoggingCallback *g_loggingCallback = NULL;\nstatic char g_messageBuffer[1024];\n\n///////////////////////////////////////////////////////////////////////////////\n// Logging Functions\n///////////////////////////////////////////////////////////////////////////////\n\nDYNAUDNORM_NS::LoggingCallback *DYNAUDNORM_NS::setLoggingHandler(LoggingCallback *const callback)\n{\n\tLoggingCallback *oldValue;\n\n\tMY_CRITSEC_ENTER(g_mutex);\n\toldValue = g_loggingCallback;\n\tg_loggingCallback = callback;\n\tMY_CRITSEC_LEAVE(g_mutex);\n\n\treturn oldValue;\n}\n\nvoid DYNAUDNORM_NS::postLogMessage(const int &logLevel, const char *const message, ...)\n{\n\tMY_CRITSEC_ENTER(g_mutex);\n\n\tif(g_loggingCallback)\n\t{\n\t\tva_list args;\n\t\tva_start (args, message);\n\t\tvsnprintf(g_messageBuffer, 1024, message, args);\n\t\tva_end(args);\n\t\tg_loggingCallback(logLevel, g_messageBuffer);\n\t}\n\n\tMY_CRITSEC_LEAVE(g_mutex);\n}\n"
  },
  {
    "path": "DynamicAudioNormalizerAPI/src/Logging.h",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Library\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This library is free software; you can redistribute it and/or\n// modify it under the terms of the GNU Lesser General Public\n// License as published by the Free Software Foundation; either\n// version 2.1 of the License, or (at your option) any later version.\n//\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public\n// License along with this library; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n//\n// http://www.gnu.org/licenses/lgpl-2.1.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#pragma once\n\n#include \"Common.h\"\n\nnamespace DYNAUDNORM_NS\n{\n\ttypedef void (LoggingCallback)(const int logLevel, const char *const message);\n\tLoggingCallback *setLoggingHandler(LoggingCallback *const callback);\n\tvoid postLogMessage(const int &logLevel, const char *const message, ...);\n}\n\n#define LOG1_DBG(X) DYNAUDNORM_NS::postLogMessage(0, (X))\n#define LOG1_WRN(X) DYNAUDNORM_NS::postLogMessage(1, (X))\n#define LOG1_ERR(X) DYNAUDNORM_NS::postLogMessage(2, (X))\n\n#define LOG2_DBG(X,...) DYNAUDNORM_NS::postLogMessage(0, (X), __VA_ARGS__)\n#define LOG2_WRN(X,...) DYNAUDNORM_NS::postLogMessage(1, (X), __VA_ARGS__)\n#define LOG2_ERR(X,...) DYNAUDNORM_NS::postLogMessage(2, (X), __VA_ARGS__)\n"
  },
  {
    "path": "DynamicAudioNormalizerAPI/src/Test_API.c",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Library\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This library is free software; you can redistribute it and/or\n// modify it under the terms of the GNU Lesser General Public\n// License as published by the Free Software Foundation; either\n// version 2.1 of the License, or (at your option) any later version.\n//\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public\n// License along with this library; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n//\n// http://www.gnu.org/licenses/lgpl-2.1.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#include \"DynamicAudioNormalizer.h\"\n\nvoid MDynamicAudioNormalizer_Test_C_API(void)\n{\n\tMDynamicAudioNormalizer_Handle *handle = MDYNAMICAUDIONORMALIZER_FUNCTION(createInstance)(2, 44100, 500, 31, 0.95, 10.0, 0.0, 0.0, 1, 0, 0, NULL);\n\tif (handle)\n\t{\n\t\tuint32_t channels, sampleRate, frameLen, filterSize;\n\t\tMDYNAMICAUDIONORMALIZER_FUNCTION(getConfiguration)(handle, &channels, &sampleRate, &frameLen, &filterSize);\n\t\tMDYNAMICAUDIONORMALIZER_FUNCTION(destroyInstance)(&handle);\n\t}\n}\n"
  },
  {
    "path": "DynamicAudioNormalizerAPI/src/Version.cpp",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Library\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This library is free software; you can redistribute it and/or\n// modify it under the terms of the GNU Lesser General Public\n// License as published by the Free Software Foundation; either\n// version 2.1 of the License, or (at your option) any later version.\n//\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public\n// License along with this library; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n//\n// http://www.gnu.org/licenses/lgpl-2.1.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#include \"Version.h\"\n\n#define INC_DYNAUDNORM_VERSION_INTERNAL 0x22b4f8a9\n#include \"../../DynamicAudioNormalizerShared/res/version.inc\"\n\n//Version info\nconst unsigned int DYNAUDNORM_NS::VERSION_MAJOR = VER_DYNAUDNORM_MAJOR;\nconst unsigned int DYNAUDNORM_NS::VERSION_MINOR = VER_DYNAUDNORM_MINOR;\nconst unsigned int DYNAUDNORM_NS::VERSION_PATCH = VER_DYNAUDNORM_PATCH;\n\n//Build date/time\nconst char *const DYNAUDNORM_NS::BUILD_DATE = __DATE__;\nconst char *const DYNAUDNORM_NS::BUILD_TIME = __TIME__;\n\n//Compiler detection\nconst char *const DYNAUDNORM_NS::BUILD_COMPILER =\n#if defined(__INTEL_COMPILER)\n\t#if (__INTEL_COMPILER >= 1600)\n\t\t\"ICL 16.x\";\n\t#elif (__INTEL_COMPILER >= 1500)\n\t\t\"ICL 15.x\";\n\t#elif (__INTEL_COMPILER >= 1400)\n\t\t\"ICL 14.x\";\n\t#elif (__INTEL_COMPILER >= 1300)\n\t\t\"ICL 13.x\";\n\t#elif (__INTEL_COMPILER >= 1200)\n\t\t\"ICL 12.x\";\n\t#elif (__INTEL_COMPILER >= 1100)\n\t\t\"ICL 11.x\";\n\t#elif (__INTEL_COMPILER >= 1000)\n\t\t\"ICL 10.x\";\n\t#else\n\t\t#error Compiler is not supported!\n\t#endif\n#elif defined(_MSC_VER)\n\t#if (_MSC_VER == 1916)\n\t\t#if((_MSC_FULL_VER >= 191627024) && (_MSC_FULL_VER <= 191627034))\n\t\t\t\"MSVC 2017.9\";\n\t\t#else\n\t\t\t#error Compiler version is not supported yet!\n\t\t#endif\n\t#elif (_MSC_VER == 1915)\n\t\t#if((_MSC_FULL_VER >= 191526726) && (_MSC_FULL_VER <= 191526732))\n\t\t\t\"MSVC 2017.8\";\n\t\t#else\n\t\t\t#error Compiler version is not supported yet!\n\t\t#endif\n\t#elif (_MSC_VER == 1914)\n\t\t#if((_MSC_FULL_VER >= 191426430) && (_MSC_FULL_VER <= 191426433))\n\t\t\t\"MSVC 2017.7\";\n\t\t#else\n\t\t\t#error Compiler version is not supported yet!\n\t\t#endif\n\t#elif (_MSC_VER == 1913)\n\t\t#if((_MSC_FULL_VER >= 191326128) && (_MSC_FULL_VER <= 191326132))\n\t\t\t\"MSVC 2017.6\";\n\t\t#else\n\t\t\t#error Compiler version is not supported yet!\n\t\t#endif\n\t#elif (_MSC_VER == 1912)\n\t\t#if((_MSC_FULL_VER >= 191225830) && (_MSC_FULL_VER <= 191225835))\n\t\t\t\"MSVC 2017.5\";\n\t\t#else\n\t\t\t#error Compiler version is not supported yet!\n\t\t#endif\n\t#elif (_MSC_VER == 1911)\n\t\t#if((_MSC_FULL_VER >= 191125542) && (_MSC_FULL_VER <= 191125547))\n\t\t\t\"MSVC 2017.4\";\n\t\t#elif((_MSC_FULL_VER >= 191125506) && (_MSC_FULL_VER <= 191125508))\n\t\t\t\"MSVC 2017.3\";\n\t\t#else\n\t\t\t#error Compiler version is not supported yet!\n\t\t#endif\n\t#elif (_MSC_VER == 1910)\n\t\t#if (_MSC_FULL_VER >= 191025017) && (_MSC_FULL_VER <= 191025019)\n\t\t\t\"MSVC 2017.2\";\n\t\t#else\n\t\t\t#error Compiler version is not supported yet!\n\t\t#endif\n\t#elif (_MSC_VER == 1900)\n\t\t#if (_MSC_FULL_VER == 190023026)\n\t\t\t\"MSVC 2015\";\n\t\t#elif (_MSC_FULL_VER == 190023506)\n\t\t\t\"MSVC 2015.1\";\n\t\t#elif (_MSC_FULL_VER == 190023918)\n\t\t\t\"MSVC 2015.2\";\n\t\t#elif (_MSC_FULL_VER >= 190024210) && (_MSC_FULL_VER <= 190024215)\n\t\t\t\"MSVC 2015.3\";\n\t\t#else\n\t\t\t#error Compiler version is not supported yet!\n\t\t#endif\n\t#elif (_MSC_VER == 1800)\n\t\t#if (_MSC_FULL_VER == 180021005)\n\t\t\t\"MSVC 2013\";\n\t\t#elif (_MSC_FULL_VER == 180030501)\n\t\t\t\"MSVC 2013.2\";\n\t\t#elif (_MSC_FULL_VER == 180030723)\n\t\t\t\"MSVC 2013.3\";\n\t\t#elif (_MSC_FULL_VER == 180031101)\n\t\t\t\"MSVC 2013.4\";\n\t\t#elif (_MSC_FULL_VER == 180040629)\n\t\t\t\"MSVC 2013.5\";\n\t\t#else\n\t\t\t#error Compiler version is not supported yet!\n\t\t#endif\n\t#elif (_MSC_VER == 1700)\n\t\t#if (_MSC_FULL_VER == 170050727)\n\t\t\t\"MSVC 2012\";\n\t\t#elif (_MSC_FULL_VER == 170051106)\n\t\t\t\"MSVC 2012.1\";\n\t\t#elif (_MSC_FULL_VER == 170060315)\n\t\t\t\"MSVC 2012.2\";\n\t\t#elif (_MSC_FULL_VER == 170060610)\n\t\t\t\"MSVC 2012.3\";\n\t\t#elif (_MSC_FULL_VER == 170061030)\n\t\t\t\"MSVC 2012.4\";\n\t\t#else\n\t\t\t#error Compiler version is not supported yet!\n\t\t#endif\n\t#elif (_MSC_VER == 1600)\n\t\t#if (_MSC_FULL_VER >= 160040219)\n\t\t\t\"MSVC 2010-SP1\";\n\t\t#else\n\t\t\t\"MSVC 2010\";\n\t\t#endif\n\t#elif (_MSC_VER == 1500)\n\t\t#if (_MSC_FULL_VER >= 150030729)\n\t\t\t\"MSVC 2008-SP1\";\n\t\t#else\n\t\t\t\"MSVC 2008\";\n\t\t#endif\n\t#else\n\t\t#error Compiler is not supported!\n\t#endif\n\t// Note: /arch:SSE and /arch:SSE2 are only available for the x86 platform\n\t#if !defined(_M_X64) && defined(_M_IX86_FP)\n\t\t#if (_M_IX86_FP == 1)\n\t\t\t#pragma message(\"SSE instruction set is enabled!\")\n\t\t#elif (_M_IX86_FP >= 2)\n\t\t\t#pragma message(\"SSE2 (or higher) instruction set is enabled!\")\n\t\t#endif\n\t#endif\n#elif defined(__GNUC__)\n\t#define GCC_VERSION_GLUE1(X,Y,Z) \"GCC \" #X \".\" #Y \".\" #Z\n\t#define GCC_VERSION_GLUE2(X,Y,Z) GCC_VERSION_GLUE1(X,Y,Z)\n\tGCC_VERSION_GLUE2(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);\n#else\n\t#error Compiler is not supported!\n#endif\n\n//Architecture detection\nconst char *const DYNAUDNORM_NS::BUILD_ARCH =\n#if defined(_M_X64) || defined(__x86_64__)\n\t\"x64\";\n#elif defined(_M_IX86) || defined(__i386__)\n\t\"x86\";\n#else\n\t#error Architecture is not supported!\n#endif\n"
  },
  {
    "path": "DynamicAudioNormalizerAPI/src/Version.h",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Library\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This library is free software; you can redistribute it and/or\n// modify it under the terms of the GNU Lesser General Public\n// License as published by the Free Software Foundation; either\n// version 2.1 of the License, or (at your option) any later version.\n//\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public\n// License along with this library; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n//\n// http://www.gnu.org/licenses/lgpl-2.1.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#pragma once\n\n#include \"Common.h\"\n\n//=============================================================================\n// Version\n//=============================================================================\n\nnamespace DYNAUDNORM_NS\n{\n\t//Version info\n\textern const unsigned int VERSION_MAJOR;\n\textern const unsigned int VERSION_MINOR;\n\textern const unsigned int VERSION_PATCH;\n\n\t//Build date/time\n\textern const char *const BUILD_DATE;\n\textern const char *const BUILD_TIME;\n\n\t//Compiler info\n\textern const char *const BUILD_COMPILER;\n\textern const char *const BUILD_ARCH;\n}\n"
  },
  {
    "path": "DynamicAudioNormalizerCLI/DynamicAudioNormalizerCLI_VS2013.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"12.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"Debug|Win32\">\n      <Configuration>Debug</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|Win32\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|Win32\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\AudioIO.cpp\" />\n    <ClCompile Include=\"src\\AudioIO_Mpg123.cpp\" />\n    <ClCompile Include=\"src\\AudioIO_SndFile.cpp\" />\n    <ClCompile Include=\"src\\Main.cpp\" />\n    <ClCompile Include=\"src\\Parameters.cpp\" />\n    <ClCompile Include=\"src\\Platform_Linux.cpp\" />\n    <ClCompile Include=\"src\\Platform_Win32.cpp\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"..\\DynamicAudioNormalizerShared\\include\\Common.h\" />\n    <ClInclude Include=\"src\\AudioIO.h\" />\n    <ClInclude Include=\"src\\AudioIO_Mpg123.h\" />\n    <ClInclude Include=\"src\\AudioIO_SndFile.h\" />\n    <ClInclude Include=\"src\\Parameters.h\" />\n    <ClInclude Include=\"src\\Platform.h\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\DynamicAudioNormalizerAPI\\DynamicAudioNormalizerAPI_VS2013.vcxproj\">\n      <Project>{376386ee-8268-47e3-a335-7663716e4c60}</Project>\n      <Private>true</Private>\n      <ReferenceOutputAssembly>true</ReferenceOutputAssembly>\n      <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>\n      <LinkLibraryDependencies>true</LinkLibraryDependencies>\n      <UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>\n    </ProjectReference>\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <ProjectGuid>{5B755CC3-EC17-490F-AE82-CBC16E2EB143}</ProjectGuid>\n    <Keyword>Win32Proj</Keyword>\n    <RootNamespace>DynamicAudioNormalizerCLI</RootNamespace>\n    <ProjectName>DynamicAudioNormalizerCLI</ProjectName>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>Application</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>Application</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>Application</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <LinkIncremental>true</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <ClCompile>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\include;$(SolutionDir)\\..\\Prerequisites\\LibSndFile\\include;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\include;$(SolutionDir)\\..\\Prerequisites\\LibMpg123\\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>\n      <InlineFunctionExpansion>Disabled</InlineFunctionExpansion>\n      <OmitFramePointers>false</OmitFramePointers>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n      <ExceptionHandling>Sync</ExceptionHandling>\n      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\n    </ClCompile>\n    <Link>\n      <SubSystem>Console</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\LibSndFile\\lib\\$(Platform)\\shared;$(SolutionDir)\\..\\Prerequisites\\LibMpg123\\lib\\$(Platform)\\shared;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>libsndfile-1.lib;libmpg123.$(PlatformToolset).lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\include;$(SolutionDir)\\..\\Prerequisites\\LibSndFile\\include;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\include;$(SolutionDir)\\..\\Prerequisites\\LibMpg123\\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Console</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\lib\\$(Platform)\\shared;$(SolutionDir)\\..\\Prerequisites\\LibSndFile\\lib\\$(Platform)\\shared;$(SolutionDir)\\..\\Prerequisites\\LibMpg123\\lib\\$(Platform)\\shared;$(SolutionDir)\\..\\Prerequisites\\VisualLeaksDetector\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>libsndfile-1.lib;libmpg123.$(PlatformToolset).lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;MDYNAMICAUDIONORMALIZER_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\include;$(SolutionDir)\\..\\Prerequisites\\LibSndFile\\include;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\include;$(SolutionDir)\\..\\Prerequisites\\LibMpg123\\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Console</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\lib\\Win32\\static;$(SolutionDir)\\..\\Prerequisites\\LibSndFile\\lib\\$(Platform)\\static;$(SolutionDir)\\..\\Prerequisites\\VisualLeaksDetector\\lib\\$(Platform);$(SolutionDir)\\..\\Prerequisites\\XiphAudioLibs\\lib\\$(Platform)\\static;$(SolutionDir)\\..\\Prerequisites\\LibMpg123\\lib\\Win32\\static;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>libsndfile_msvc.$(PlatformToolset).lib;libogg_static.$(PlatformToolset).lib;libvorbis_static.$(PlatformToolset).lib;libFLAC_static.$(PlatformToolset).lib;libmpg123.$(PlatformToolset).lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerCLI/DynamicAudioNormalizerCLI_VS2013.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\Main.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\Parameters.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\Platform_Linux.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\Platform_Win32.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\AudioIO_SndFile.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\AudioIO.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\AudioIO_Mpg123.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"src\\Parameters.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"..\\DynamicAudioNormalizerShared\\include\\Common.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\Platform.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\AudioIO.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\AudioIO_SndFile.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\AudioIO_Mpg123.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerCLI/DynamicAudioNormalizerCLI_VS2015.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"14.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"Debug|Win32\">\n      <Configuration>Debug</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|Win32\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|Win32\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\AudioIO.cpp\" />\n    <ClCompile Include=\"src\\AudioIO_Mpg123.cpp\" />\n    <ClCompile Include=\"src\\AudioIO_SndFile.cpp\" />\n    <ClCompile Include=\"src\\Main.cpp\" />\n    <ClCompile Include=\"src\\Parameters.cpp\" />\n    <ClCompile Include=\"src\\Platform_Linux.cpp\" />\n    <ClCompile Include=\"src\\Platform_Win32.cpp\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"..\\DynamicAudioNormalizerShared\\include\\Common.h\" />\n    <ClInclude Include=\"src\\AudioIO.h\" />\n    <ClInclude Include=\"src\\AudioIO_Mpg123.h\" />\n    <ClInclude Include=\"src\\AudioIO_SndFile.h\" />\n    <ClInclude Include=\"src\\Parameters.h\" />\n    <ClInclude Include=\"src\\Platform.h\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\DynamicAudioNormalizerAPI\\DynamicAudioNormalizerAPI_VS2015.vcxproj\">\n      <Project>{376386ee-8268-47e3-a335-7663716e4c60}</Project>\n      <Private>true</Private>\n      <ReferenceOutputAssembly>true</ReferenceOutputAssembly>\n      <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>\n      <LinkLibraryDependencies>true</LinkLibraryDependencies>\n      <UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>\n    </ProjectReference>\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <ProjectGuid>{5B755CC3-EC17-490F-AE82-CBC16E2EB143}</ProjectGuid>\n    <Keyword>Win32Proj</Keyword>\n    <RootNamespace>DynamicAudioNormalizerCLI</RootNamespace>\n    <ProjectName>DynamicAudioNormalizerCLI</ProjectName>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>Application</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>Application</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>Application</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <LinkIncremental>true</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <ClCompile>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\include;$(SolutionDir)\\..\\Prerequisites\\LibSndFile\\include;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\include;$(SolutionDir)\\..\\Prerequisites\\LibMpg123\\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>\n      <InlineFunctionExpansion>Disabled</InlineFunctionExpansion>\n      <OmitFramePointers>false</OmitFramePointers>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n      <ExceptionHandling>Sync</ExceptionHandling>\n      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\n    </ClCompile>\n    <Link>\n      <SubSystem>Console</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\LibSndFile\\lib\\$(Platform)\\shared;$(SolutionDir)\\..\\Prerequisites\\LibMpg123\\lib\\$(Platform)\\shared;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>libsndfile-1.lib;libmpg123.$(PlatformToolset).lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\include;$(SolutionDir)\\..\\Prerequisites\\LibSndFile\\include;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\include;$(SolutionDir)\\..\\Prerequisites\\LibMpg123\\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Console</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\lib\\$(Platform)\\shared;$(SolutionDir)\\..\\Prerequisites\\LibSndFile\\lib\\$(Platform)\\shared;$(SolutionDir)\\..\\Prerequisites\\LibMpg123\\lib\\$(Platform)\\shared;$(SolutionDir)\\..\\Prerequisites\\VisualLeaksDetector\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>libsndfile-1.lib;libmpg123.$(PlatformToolset).lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;MDYNAMICAUDIONORMALIZER_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\include;$(SolutionDir)\\..\\Prerequisites\\LibSndFile\\include;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\include;$(SolutionDir)\\..\\Prerequisites\\LibMpg123\\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Console</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\lib\\Win32\\static;$(SolutionDir)\\..\\Prerequisites\\LibSndFile\\lib\\$(Platform)\\static;$(SolutionDir)\\..\\Prerequisites\\VisualLeaksDetector\\lib\\$(Platform);$(SolutionDir)\\..\\Prerequisites\\XiphAudioLibs\\lib\\$(Platform)\\static;$(SolutionDir)\\..\\Prerequisites\\LibMpg123\\lib\\Win32\\static;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>libsndfile_msvc.$(PlatformToolset).lib;libogg_static.$(PlatformToolset).lib;libvorbis_static.$(PlatformToolset).lib;libFLAC_static.$(PlatformToolset).lib;libmpg123.$(PlatformToolset).lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerCLI/DynamicAudioNormalizerCLI_VS2015.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\Main.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\Parameters.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\Platform_Linux.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\Platform_Win32.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\AudioIO_SndFile.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\AudioIO.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\AudioIO_Mpg123.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"src\\Parameters.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"..\\DynamicAudioNormalizerShared\\include\\Common.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\Platform.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\AudioIO.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\AudioIO_SndFile.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\AudioIO_Mpg123.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerCLI/DynamicAudioNormalizerCLI_VS2017.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"14.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"Debug|Win32\">\n      <Configuration>Debug</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|Win32\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|Win32\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\AudioIO.cpp\" />\n    <ClCompile Include=\"src\\AudioIO_Mpg123.cpp\" />\n    <ClCompile Include=\"src\\AudioIO_OpusFile.cpp\" />\n    <ClCompile Include=\"src\\AudioIO_SndFile.cpp\" />\n    <ClCompile Include=\"src\\Main.cpp\" />\n    <ClCompile Include=\"src\\Parameters.cpp\" />\n    <ClCompile Include=\"src\\Platform_Linux.cpp\" />\n    <ClCompile Include=\"src\\Platform_Win32.cpp\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"..\\DynamicAudioNormalizerShared\\include\\Common.h\" />\n    <ClInclude Include=\"src\\3rd_party\\memmem.h\" />\n    <ClInclude Include=\"src\\AudioIO.h\" />\n    <ClInclude Include=\"src\\AudioIO_Mpg123.h\" />\n    <ClInclude Include=\"src\\AudioIO_OpusFile.h\" />\n    <ClInclude Include=\"src\\AudioIO_SndFile.h\" />\n    <ClInclude Include=\"src\\Parameters.h\" />\n    <ClInclude Include=\"src\\Platform.h\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\DynamicAudioNormalizerAPI\\DynamicAudioNormalizerAPI_VS2017.vcxproj\">\n      <Project>{376386ee-8268-47e3-a335-7663716e4c60}</Project>\n      <Private>true</Private>\n      <ReferenceOutputAssembly>true</ReferenceOutputAssembly>\n      <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>\n      <LinkLibraryDependencies>true</LinkLibraryDependencies>\n      <UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>\n    </ProjectReference>\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"res\\DynamicAudioNormalizerCLI.rc\" />\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <ProjectGuid>{5B755CC3-EC17-490F-AE82-CBC16E2EB143}</ProjectGuid>\n    <Keyword>Win32Proj</Keyword>\n    <RootNamespace>DynamicAudioNormalizerCLI</RootNamespace>\n    <ProjectName>DynamicAudioNormalizerCLI</ProjectName>\n    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>Application</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>Application</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>Application</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <LinkIncremental>true</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <ClCompile>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\include;$(SolutionDir)\\..\\Prerequisites\\LibSndFile\\include;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\include;$(SolutionDir)\\..\\Prerequisites\\LibMpg123\\include;$(SolutionDir)\\..\\Prerequisites\\XiphAudioLibs\\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>\n      <InlineFunctionExpansion>Disabled</InlineFunctionExpansion>\n      <OmitFramePointers>false</OmitFramePointers>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n      <ExceptionHandling>Sync</ExceptionHandling>\n      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\n    </ClCompile>\n    <Link>\n      <SubSystem>Console</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\LibSndFile\\lib\\$(Platform)\\shared;$(SolutionDir)\\..\\Prerequisites\\LibMpg123\\lib\\$(Platform)\\shared;$(SolutionDir)\\..\\Prerequisites\\XiphAudioLibs\\lib\\$(Platform)\\shared;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>libsndfile-1.lib;libmpg123.$(PlatformToolset).lib;libopus.$(PlatformToolset).lib;libopusfile.$(PlatformToolset).lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\include;$(SolutionDir)\\..\\Prerequisites\\LibSndFile\\include;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\include;$(SolutionDir)\\..\\Prerequisites\\LibMpg123\\include;$(SolutionDir)\\..\\Prerequisites\\XiphAudioLibs\\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Console</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\lib\\$(Platform)\\shared;$(SolutionDir)\\..\\Prerequisites\\LibSndFile\\lib\\$(Platform)\\shared;$(SolutionDir)\\..\\Prerequisites\\LibMpg123\\lib\\$(Platform)\\shared;$(SolutionDir)\\..\\Prerequisites\\XiphAudioLibs\\lib\\$(Platform)\\shared;$(SolutionDir)\\..\\Prerequisites\\VisualLeaksDetector\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>libsndfile-1.lib;libmpg123.$(PlatformToolset).lib;libopus.$(PlatformToolset).lib;libopusfile.$(PlatformToolset).lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n    <Manifest>\n      <AdditionalManifestFiles>$(SolutionDir)DynamicAudioNormalizerShared\\res\\compat.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>\n    </Manifest>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;MDYNAMICAUDIONORMALIZER_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\include;$(SolutionDir)\\..\\Prerequisites\\LibSndFile\\include;$(SolutionDir)\\..\\Prerequisites\\VisualLeakDetector\\include;$(SolutionDir)\\..\\Prerequisites\\LibMpg123\\include;$(SolutionDir)\\..\\Prerequisites\\XiphAudioLibs\\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Console</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\EncodePointer\\lib;$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\lib\\Win32\\static;$(SolutionDir)\\..\\Prerequisites\\LibSndFile\\lib\\$(Platform)\\static;$(SolutionDir)\\..\\Prerequisites\\VisualLeaksDetector\\lib\\$(Platform);$(SolutionDir)\\..\\Prerequisites\\XiphAudioLibs\\lib\\$(Platform)\\static;$(SolutionDir)\\..\\Prerequisites\\LibMpg123\\lib\\Win32\\static;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>EncodePointer.lib;libsndfile_msvc.$(PlatformToolset).lib;libogg_static.$(PlatformToolset).lib;libvorbis_static.$(PlatformToolset).lib;libFLAC_static.$(PlatformToolset).lib;libmpg123.$(PlatformToolset).lib;libopus_static.$(PlatformToolset).lib;libopusfile_static.$(PlatformToolset).lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n      <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>\n    </Link>\n    <Manifest>\n      <AdditionalManifestFiles>$(SolutionDir)DynamicAudioNormalizerShared\\res\\compat.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>\n    </Manifest>\n  </ItemDefinitionGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerCLI/DynamicAudioNormalizerCLI_VS2017.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n    <Filter Include=\"Header Files\\3rd Party Sources\">\n      <UniqueIdentifier>{bd2e7d56-31ce-46cc-88f9-34740968028e}</UniqueIdentifier>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\Main.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\Parameters.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\Platform_Linux.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\Platform_Win32.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\AudioIO_SndFile.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\AudioIO.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\AudioIO_Mpg123.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\AudioIO_OpusFile.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"src\\Parameters.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"..\\DynamicAudioNormalizerShared\\include\\Common.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\Platform.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\AudioIO.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\AudioIO_SndFile.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\AudioIO_Mpg123.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\AudioIO_OpusFile.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\3rd_party\\memmem.h\">\n      <Filter>Header Files\\3rd Party Sources</Filter>\n    </ClInclude>\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"res\\DynamicAudioNormalizerCLI.rc\">\n      <Filter>Resource Files</Filter>\n    </ResourceCompile>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerCLI/makefile",
    "content": "##############################################################################\n# Dynamic Audio Normalizer - Audio Processing Utility\n# Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n#\n# This program is free software; you can redistribute it and/or\n# modify it under the terms of the GNU General Public License\n# as published by the Free Software Foundation; either version 2\n# of the License, or (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n#\n# http://www.gnu.org/licenses/gpl-2.0.txt\n##############################################################################\n\nECHO=echo -e\nSHELL=/bin/bash\n\n##############################################################################\n# Constants\n##############################################################################\n\nPROGRAM_NAME := DynamicAudioNormalizerCLI\n\nifndef API_VERSION\n   $(error API_VERSION variable is not set!)\nendif\n\n##############################################################################\n# Flags\n##############################################################################\n\nDEBUG_BUILD ?= 0\nMARCH ?= native\n\nifeq ($(DEBUG_BUILD), 1)\n   CONFIG_NAME = Debug\n   CXXFLAGS = -g -O0 -D_DEBUG\nelse\n   CONFIG_NAME = Release\n   CXXFLAGS = -O3 -Wall -ffast-math -mfpmath=sse -msse -fomit-frame-pointer -fno-tree-vectorize -DNDEBUG -march=$(MARCH)\nendif\n\nCXXFLAGS += -std=gnu++11\nCXXFLAGS += -I./src\nCXXFLAGS += -I./include\nCXXFLAGS += -I../DynamicAudioNormalizerAPI/include\nCXXFLAGS += -I../DynamicAudioNormalizerShared/include\n\nifeq ($(findstring MINGW,$(shell uname -s)),MINGW)\n   CXXFLAGS += -I../../libsndfile/include\n   LDXFLAGS += -L../../libsndfile/lib\nelse\n   LDXFLAGS += -Wl,-rpath,'$$ORIGIN'\nendif\n\nLDXFLAGS += -L../DynamicAudioNormalizerAPI/lib\nLDXFLAGS += -lDynamicAudioNormalizerAPI-$(API_VERSION)\n\n#Externel libraries\nLDXFLAGS += -lsndfile -lmpg123\n\n##############################################################################\n# File Names\n##############################################################################\n\nifeq ($(findstring MINGW,$(shell uname -s)),MINGW)\n   PRG_EXT = exe\nelse\n   PRG_EXT = bin\nendif\n\nSOURCES_CPP = $(wildcard src/*.cpp)\nSOURCES_OBJ = $(patsubst %.cpp,%.o,$(SOURCES_CPP))\n\nPROGRAM_OUT = bin/$(PROGRAM_NAME)\nPROGRAM_BIN = $(PROGRAM_OUT).$(PRG_EXT)\nPROGRAM_DBG = $(PROGRAM_OUT)-DBG.$(PRG_EXT)\n\n##############################################################################\n# Rules\n##############################################################################\n\n.PHONY: all clean\n\nall: $(PROGRAM_BIN)\n\n#-------------------------------------------------------------\n# Link & Strip\n#-------------------------------------------------------------\n\n$(PROGRAM_BIN): $(PROGRAM_DBG)\n\t@$(ECHO) \"\\e[1;36m[STR] $@\\e[0m\"\n\t@mkdir -p $(dir $@)\nifeq ($(shell uname), Darwin)\n\tstrip -u -r -x -o $@ $<\nelse\n\tstrip --strip-unneeded -o $@ $<\nendif\n\n$(PROGRAM_DBG): $(SOURCES_OBJ)\n\t@$(ECHO) \"\\e[1;36m[LNK] $@\\e[0m\"\n\t@mkdir -p $(dir $@)\n\tg++ -o $@ $+ $(LDXFLAGS)\n\n#-------------------------------------------------------------\n# Compile\n#-------------------------------------------------------------\n\n%.o: %.cpp\n\t@$(ECHO) \"\\e[1;36m[CXX] $<\\e[0m\"\n\t@mkdir -p $(dir $@)\n\tg++ $(CXXFLAGS) -c $< -o $@\n\n#-------------------------------------------------------------\n# Clean\n#-------------------------------------------------------------\n\nclean:\n\trm -fv $(SOURCES_OBJ)\n\trm -rfv ./bin\n\n"
  },
  {
    "path": "DynamicAudioNormalizerCLI/res/DynamicAudioNormalizerCLI.rc",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Library\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This library is free software; you can redistribute it and/or\n// modify it under the terms of the GNU Lesser General Public\n// License as published by the Free Software Foundation; either\n// version 2.1 of the License, or (at your option) any later version.\n//\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public\n// License along with this library; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n//\n// http://www.gnu.org/licenses/lgpl-2.1.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#include \"WinResrc.h\" //\"afxres.h\"\n\n#define INC_DYNAUDNORM_VERSION_INTERNAL 0x22b4f8a9\n#include \"../DynamicAudioNormalizerShared/res/version.inc\"\n\n//////////////////////////////////////////////////////////////////////////////////\n// Neutral resources\n//////////////////////////////////////////////////////////////////////////////////\n\n#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)\n#ifdef _WIN32\nLANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL\n#pragma code_page(1252)\n#endif //_WIN32\n\n//////////////////////////////////////////////////////////////////////////////////\n// Version\n//////////////////////////////////////////////////////////////////////////////////\n\nVS_VERSION_INFO VERSIONINFO\n FILEVERSION    VER_DYNAUDNORM_MAJOR,VER_DYNAUDNORM_MINOR_HI,VER_DYNAUDNORM_MINOR_LO,VER_DYNAUDNORM_PATCH\n PRODUCTVERSION VER_DYNAUDNORM_MAJOR,VER_DYNAUDNORM_MINOR_HI,VER_DYNAUDNORM_MINOR_LO,VER_DYNAUDNORM_PATCH\n FILEFLAGSMASK 0x17L\n#ifdef _DEBUG\n FILEFLAGS 0x3L\n#else\n FILEFLAGS 0x2L\n#endif\n FILEOS 0x40004L\n FILETYPE 0x1L\n FILESUBTYPE 0x0L\nBEGIN\n    BLOCK \"StringFileInfo\"\n    BEGIN\n        BLOCK \"000004b0\"\n        BEGIN\n            VALUE \"Comments\", \"This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License <http://www.gnu.org/>.\"\n            VALUE \"CompanyName\", \"LoRd_MuldeR <mulder2@gmx.de>\"\n            VALUE \"FileDescription\", \"DynamicAudioNormalizer Command-Line Interface\"\n            VALUE \"FileVersion\", VER_DYNAUDNORM_STR\n            VALUE \"InternalName\", \"DynamicAudioNormalizerCLI\"\n            VALUE \"LegalCopyright\", \"Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>\"\n            VALUE \"LegalTrademarks\", \"This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License <http://www.gnu.org/>\"\n            VALUE \"OriginalFilename\", \"DynamicAudioNormalizerCLI.exe\"\n            VALUE \"ProductName\", \"DynamicAudioNormalizer\"\n            VALUE \"ProductVersion\", VER_DYNAUDNORM_STR\n        END\n    END\n    BLOCK \"VarFileInfo\"\n    BEGIN\n        VALUE \"Translation\", 0x0, 1200\n    END\nEND\n\n#endif    // Neutral resources\n"
  },
  {
    "path": "DynamicAudioNormalizerCLI/src/3rd_party/memmem.h",
    "content": "/*\n * Copyright (C) 2008 The Android Open Source Project\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *  * Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n *  * Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS\n * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED\n * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT\n * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n/*\n * This uses the \"Not So Naive\" algorithm, a very simple but\n * usually effective algorithm, see:\n * http://www-igm.univ-mlv.fr/~lecroq/string/\n */\n\n#include <string.h>\n\n#ifdef __GNUC__\n#define _EXPECT(X,Y) __builtin_expect((X),(Y))\n#else\n#define _EXPECT(X,Y) (X)\n#endif\n\nstatic const void *memmem(const void *haystack, size_t n, const void *needle, size_t m)\n{\n\tif ((m > n) || (!m) || (!n))\n\t{\n\t\treturn NULL;\n\t}\n\tif (_EXPECT((m > 1), 1))\n\t{\n\t\tconst unsigned char*  y = (const unsigned char*)haystack;\n\t\tconst unsigned char*  x = (const unsigned char*)needle;\n\t\tsize_t                j = 0;\n\t\tsize_t                k = 1, l = 2;\n\t\tif (x[0] == x[1])\n\t\t{\n\t\t\tk = 2;\n\t\t\tl = 1;\n\t\t}\n\t\twhile (j <= (n - m))\n\t\t{\n\t\t\tif (x[1] != y[j + 1])\n\t\t\t{\n\t\t\t\tj += k;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (!memcmp(x + 2, y + j + 2, m - 2) && (x[0] == y[j]))\n\t\t\t\t{\n\t\t\t\t\treturn (void*)&y[j];\n\t\t\t\t}\n\t\t\t\tj += l;\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\t/* degenerate case */\n\t\treturn memchr(haystack, ((unsigned char*)needle)[0], n);\n\t}\n\treturn NULL;\n}\n"
  },
  {
    "path": "DynamicAudioNormalizerCLI/src/AudioIO.cpp",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Utility\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This program is free software; you can redistribute it and/or\n// modify it under the terms of the GNU General Public License\n// as published by the Free Software Foundation; either version 2\n// of the License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n//\n// http://www.gnu.org/licenses/gpl-2.0.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#include \"AudioIO.h\"\n#include \"AudioIO_SndFile.h\"\n#include \"AudioIO_Mpg123.h\"\n#include \"AudioIO_OpusFile.h\"\n\n#include <Common.h>\n#include <algorithm>\n\n#ifdef __unix\n#include <unistd.h>\n#else\n#define STDIN_FILENO  0\n#define STDOUT_FILENO 1\n#define STDERR_FILENO 2\n#endif\n\n///////////////////////////////////////////////////////////////////////////////\n// Helper Functions\n///////////////////////////////////////////////////////////////////////////////\n\n//AudioIO libraries\nstatic const uint8_t AUDIO_LIB_NULL        = 0x00u;\nstatic const uint8_t AUDIO_LIB_LIBSNDFILE  = 0x01u;\nstatic const uint8_t AUDIO_LIB_LIBOPUSFILE = 0x02u;\nstatic const uint8_t AUDIO_LIB_LIBMPG123   = 0x03u;\n\n//Function prototypes\ntypedef const CHR *       (libraryVersion_t)  (void);\ntypedef const CHR *const *(supportedFormats_t)(const CHR **const list, const uint32_t maxLen);\ntypedef bool              (checkFileType_t)   (FILE *const);\ntypedef AudioIO*          (createInstance_t)  (void);\n\n//AudioIO library mappings\nstatic const struct\n{\n\tconst CHR                 name[16];\n\tconst uint8_t             id;\n\tlibraryVersion_t   *const libraryVersion;\n\tsupportedFormats_t *const supportedFormats;\n\tcheckFileType_t    *const checkFileType;\n\tcreateInstance_t   *const createInstance;\n}\ng_audioIO_mapping[] =\n{\n\t{ TXT(\"libsndfile\"),  AUDIO_LIB_LIBSNDFILE,  AudioIO_SndFile ::libraryVersion, AudioIO_SndFile ::supportedFormats, AudioIO_SndFile ::checkFileType, AudioIO_SndFile ::createInstance },\n\t{ TXT(\"libopusfile\"), AUDIO_LIB_LIBOPUSFILE, AudioIO_OpusFile::libraryVersion, AudioIO_OpusFile::supportedFormats, AudioIO_OpusFile::checkFileType, AudioIO_OpusFile::createInstance },\n\t{ TXT(\"libmpg123\"),   AUDIO_LIB_LIBMPG123,   AudioIO_Mpg123  ::libraryVersion, AudioIO_Mpg123  ::supportedFormats, AudioIO_Mpg123  ::checkFileType, AudioIO_Mpg123  ::createInstance },\n\t{ TXT(\"\"),            AUDIO_LIB_NULL,        NULL,                             NULL,                               NULL,                            NULL                             }\n};\n\n//Get id from AudioIO library name\nstatic uint8_t parseName(const CHR *const name)\n{\n\tif (name && name[0])\n\t{\n\t\tfor (size_t i = 0; g_audioIO_mapping[i].id; ++i)\n\t\t{\n\t\t\tif (STRCASECMP(name, g_audioIO_mapping[i].name) == 0)\n\t\t\t{\n\t\t\t\treturn g_audioIO_mapping[i].id;\n\t\t\t}\n\t\t}\n\t\treturn AUDIO_LIB_NULL;\n\t}\n\telse\n\t{\n\t\treturn AUDIO_LIB_LIBSNDFILE; /*default*/\n\t}\n}\n\n//Get id from AudioIO library name\nstatic const CHR* getLibName(const uint8_t id)\n{\n\tfor (size_t i = 0; g_audioIO_mapping[i].id; ++i)\n\t{\n\t\tif (g_audioIO_mapping[i].id == id)\n\t\t{\n\t\t\treturn g_audioIO_mapping[i].name;\n\t\t}\n\t}\n\treturn NULL;\n}\n\n//Check file type\nstatic bool checkFileType(bool(*const check)(FILE *const), FILE *const file)\n{\n\tconst bool check_result = check(file);\n\trewind(file);\n\treturn check_result;\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// AudioIO Factory\n///////////////////////////////////////////////////////////////////////////////\n\nconst CHR *const *AudioIO::getSupportedLibraries(const CHR **const list, const uint32_t maxLen)\n{\n\tif (list && (maxLen > 0))\n\t{\n\t\tuint32_t nextPos = 0;\n\t\tfor (size_t i = 0; g_audioIO_mapping[i].id; ++i)\n\t\t{\n\t\t\tif (g_audioIO_mapping[i].name[0] && (nextPos < maxLen))\n\t\t\t{\n\t\t\t\tlist[nextPos++] = &g_audioIO_mapping[i].name[0];\n\t\t\t}\n\t\t}\n\t\tlist[(nextPos < maxLen) ? nextPos : (maxLen - 1)] = NULL;\n\t}\n\treturn list;\n}\n\nAudioIO *AudioIO::createInstance(const CHR *const name)\n{\n\tconst uint8_t id = parseName(name);\n\tfor (size_t i = 0; g_audioIO_mapping[i].id; ++i)\n\t{\n\t\tif (g_audioIO_mapping[i].id == id)\n\t\t{\n\t\t\treturn g_audioIO_mapping[i].createInstance();\n\t\t}\n\t}\n\tthrow \"Unsupported audio I/O library!\";\n}\n\nconst CHR *const *AudioIO::getSupportedFormats(const CHR **const list, const uint32_t maxLen, const CHR *const name)\n{\n\tconst uint8_t id = parseName(name);\n\tfor (size_t i = 0; g_audioIO_mapping[i].id; ++i)\n\t{\n\t\tif (g_audioIO_mapping[i].id == id)\n\t\t{\n\t\t\treturn g_audioIO_mapping[i].supportedFormats(list, maxLen);\n\t\t}\n\t}\n\tthrow \"Unsupported audio I/O library!\";\n}\n\nconst CHR *AudioIO::getLibraryVersion(const CHR *const name)\n{\n\tconst uint8_t id = parseName(name);\n\tfor (size_t i = 0; g_audioIO_mapping[i].id; ++i)\n\t{\n\t\tif (g_audioIO_mapping[i].id == id)\n\t\t{\n\t\t\treturn g_audioIO_mapping[i].libraryVersion();\n\t\t}\n\t}\n\tthrow \"Unsupported audio I/O library!\";\n}\n\nconst CHR *AudioIO::detectSourceType(const CHR *const fileName, const bool verbose)\n{\n\tif (verbose)\n\t{\n\t\tPRINT_NFO(TXT(\"------- Audio I/O -------\"));\n\t}\n\t\n\tuint8_t type = AUDIO_LIB_NULL;\n\tconst bool bStdIn = (STRCASECMP(fileName, TXT(\"-\")) == 0);\n\n\tif (bStdIn || PATH_ISREG(fileName))\n\t{\n\t\tif (FILE *const file = bStdIn ? stdin : FOPEN(fileName, TXT(\"rb\")))\n\t\t{\n\t\t\tif (FD_ISREG(FILENO(file)))\n\t\t\t{\n\t\t\t\tfor (size_t i = 0; g_audioIO_mapping[i].id; ++i)\n\t\t\t\t{\n\t\t\t\t\tif (verbose)\n\t\t\t\t\t{\n\t\t\t\t\t\tPRINT2_NFO(TXT(\"Trying input module \") FMT_CHR TXT(\"...\"), g_audioIO_mapping[i].name);\n\t\t\t\t\t}\n\t\t\t\t\tif (checkFileType(g_audioIO_mapping[i].checkFileType, file))\n\t\t\t\t\t{\n\t\t\t\t\t\ttype = g_audioIO_mapping[i].id;\n\t\t\t\t\t\tif (verbose)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tPRINT_NFO(TXT(\"succeeded.\"));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!bStdIn)\n\t\t\t{\n\t\t\t\tfclose(file);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (verbose)\n\t{\n\t\tif(type == AUDIO_LIB_NULL)\n\t\t{\n\t\t\tPRINT_NFO(TXT(\"No suitable input module found -> falling back to default!\"));\n\t\t}\n\t\tPRINT_NFO(TXT(\"------- Audio I/O -------\\n\"));\n\t}\n\n\treturn getLibName(type);\n}\n"
  },
  {
    "path": "DynamicAudioNormalizerCLI/src/AudioIO.h",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Utility\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This program is free software; you can redistribute it and/or\n// modify it under the terms of the GNU General Public License\n// as published by the Free Software Foundation; either version 2\n// of the License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n//\n// http://www.gnu.org/licenses/gpl-2.0.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#pragma once\n\n#include <stdint.h>\n#include \"Platform.h\"\n\n///////////////////////////////////////////////////////////////////////////////\n// AudioIO Interface\n///////////////////////////////////////////////////////////////////////////////\n\nclass AudioIO\n{\npublic:\n\tAudioIO(void) {};\n\tvirtual ~AudioIO(void) {}\n\n\t//Functions implemented in derived classes\n\tvirtual bool openRd(const CHR *const fileName, const uint32_t channels, const uint32_t sampleRate, const uint32_t bitDepth) = 0;\n\tvirtual bool openWr(const CHR *const fileName, const uint32_t channels, const uint32_t sampleRate, const uint32_t bitDepth, const CHR *const format = NULL) = 0;\n\tvirtual int64_t read(double **buffer, const int64_t count) = 0;\n\tvirtual int64_t write(double *const *buffer, const int64_t count) = 0;\n\tvirtual bool close(void) = 0;\n\tvirtual bool queryInfo(uint32_t &channels, uint32_t &sampleRate, int64_t &length, uint32_t &bitDepth) = 0;\n\tvirtual void getFormatInfo(CHR *buffer, const uint32_t buffSize) = 0;\n\t\n\t//Static \"factory\" functions\n\tstatic const CHR *const *getSupportedLibraries(const CHR **const list, const uint32_t maxLen);\n\tstatic AudioIO *createInstance(const CHR *const name = NULL);\n\tstatic const CHR *const *getSupportedFormats(const CHR **const list, const uint32_t maxLen, const CHR *const name = NULL);\n\tstatic const CHR *getLibraryVersion(const CHR *const name = NULL);\n\n\t//File type auto-detection\n\tstatic const CHR *detectSourceType(const CHR *const fileName = NULL, const bool verbose = false);\n\nprivate:\n\tAudioIO(const AudioIO &)            { throw 666; }\n\tAudioIO &operator=(const AudioIO &) { throw 666; }\n};\n"
  },
  {
    "path": "DynamicAudioNormalizerCLI/src/AudioIO_Mpg123.cpp",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Utility\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This program is free software; you can redistribute it and/or\n// modify it under the terms of the GNU General Public License\n// as published by the Free Software Foundation; either version 2\n// of the License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n//\n// http://www.gnu.org/licenses/gpl-2.0.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#define __STDC_LIMIT_MACROS\n\n#include \"AudioIO_Mpg123.h\"\n#include <Common.h>\n#include <Threads.h>\n\n#ifdef _WIN32\n#include <mpg123_msvc.h>\n#define MPG123OPEN(X,Y) mpg123_topen((X),(Y))\n#define MPG123CLOSE(X)  mpg123_tclose((X))\n#else\n#include <mpg123.h>\n#define MPG123OPEN(X,Y) mpg123_open((X),(Y))\n#define MPG123CLOSE(X)  mpg123_close((X))\n#endif\n\n#include <stdexcept>\n#include <algorithm>\n\n#ifdef __unix\n#include <unistd.h>\n#else\n#define STDIN_FILENO  0\n#define STDOUT_FILENO 1\n#define STDERR_FILENO 2\n#endif\n\n#define MPG123_DELETE(X) do \\\n{ \\\n\tif((X)) \\\n\t{ \\\n\t\tmpg123_delete((X)); \\\n\t\t(X) = NULL; \\\n\t} \\\n} \\\nwhile(0)\n\n#define MY_THROW(X) throw std::runtime_error((X))\n\n///////////////////////////////////////////////////////////////////////////////\n// Const\n///////////////////////////////////////////////////////////////////////////////\n\nstatic const size_t MPG123_HDR_SIZE = 4U;\n\nstatic const uint32_t MPG123_SRATE[2][4] =\n{\n\t{ 22050, 24000, 16000, 0 }, /*V2*/\n\t{ 44100, 48000, 32000, 0 }  /*V1*/\n};\n\nstatic const uint32_t MPG123_BITRT[2][4][16] =\n{\n\t{\n\t\t{ 0,  0,  0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 0 }, /*V2*/\n\t\t{ 0,  8, 16, 24,  32,  40,  48,  56,  64,  80,  96, 112, 128, 144, 160, 0 }, /*L3*/\n\t\t{ 0,  8, 16, 24,  32,  40,  48,  56,  64,  80,  96, 112, 128, 144, 160, 0 }, /*L2*/\n\t\t{ 0, 32, 48, 56,  64,  80,  96, 112, 128, 144, 160, 176, 192, 224, 256, 0 }, /*L1*/\n\t},\n\t{\n\t\t{ 0,  0,  0,  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 0 }, /*V1*/\n\t\t{ 0, 32, 40, 48,  56,  64,  80,  96, 112, 128, 160, 192, 224, 256, 320, 0 }, /*L3*/\n\t\t{ 0, 32, 48, 56,  64,  80,  96, 112, 128, 160, 192, 224, 256, 320, 384, 0 }, /*L2*/\n\t\t{ 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 0 }, /*L1*/\n\t}\n};\n\nstatic const uint32_t MPG123_FSIZE[2][4] =\n{\n\t{ 0,  72, 144, 48 }, /*V2*/\n\t{ 0, 144, 144, 48 }  /*V1*/\n};\n\n///////////////////////////////////////////////////////////////////////////////\n// FMT123.H COMPAT\n///////////////////////////////////////////////////////////////////////////////\n\n#ifndef MPG123_ENC_H\n#define MPG123_SAMPLESIZE(enc) ((enc) & MPG123_ENC_8 ? 1 : ((enc) & \\\n   MPG123_ENC_16 ? 2 : ((enc) & MPG123_ENC_24 ? 3 : (((enc) & MPG123_ENC_32 || \\\n  (enc) == MPG123_ENC_FLOAT_32) ? 4 : ((enc) == MPG123_ENC_FLOAT_64 ? 8 : 0)))))\nstruct mpg123_fmt\n{\n\tlong rate;\n\tint channels;\n\tint encoding;\n};\n#endif //MPG123_ENC_H\n\n///////////////////////////////////////////////////////////////////////////////\n// Private Data\n///////////////////////////////////////////////////////////////////////////////\n\nclass AudioIO_Mpg123_Private\n{\npublic:\n\tAudioIO_Mpg123_Private(void);\n\t~AudioIO_Mpg123_Private(void);\n\n\t//Open and Close\n\tbool openRd(const CHR *const fileName, const uint32_t channels, const uint32_t sampleRate, const uint32_t bitDepth);\n\tbool openWr(const CHR *const fileName, const uint32_t channels, const uint32_t sampleRate, const uint32_t bitDepth, const CHR *const format);\n\tbool close(void);\n\n\t//Read and Write\n\tint64_t read(double **buffer, const int64_t count);\n\tint64_t write(double *const *buffer, const int64_t count);\n\n\t//Query info\n\tbool queryInfo(uint32_t &channels, uint32_t &sampleRate, int64_t &length, uint32_t &bitDepth);\n\tvoid getFormatInfo(CHR *buffer, const uint32_t buffSize);\n\n\t//Library info\n\tstatic const CHR *libraryVersion(void);\n\tstatic const CHR *const *supportedFormats(const CHR **const list, const uint32_t maxLen);\n\tstatic bool checkFileType(FILE *const);\n\nprivate:\n\t//libmpg123\n\tmpg123_handle *handle;\n\n\t//audio format info\n\tstruct mpg123_fmt format;\n\n\t//(De)Interleaving buffer\n\tuint8_t *tempBuff;\n\tsize_t frameSize, buffSize;\n\n\t//Library info\n\tstatic MY_CRITSEC_DECL(mutex_lock);\n\tstatic CHR versionBuffer[256];\n\tstatic uint32_t instanceCounter;\n\n\t//Helper functions\n\tstatic uint32_t checkMpg123Sequence(const uint8_t *const buffer, const size_t &count, uint32_t &max_sequence);\n\tstatic bool checkMpg123SyncWord(const uint8_t *const buffer, const size_t &fpos);\n\ttemplate<typename T> static void deinterleave(double **destination, const int64_t offset, const T *const source, const int &channels, const int64_t &len);\n\tstatic void libraryInit(void);\n\tstatic void libraryExit(void);\n};\n\n///////////////////////////////////////////////////////////////////////////////\n// Constructor & Destructor\n///////////////////////////////////////////////////////////////////////////////\n\nAudioIO_Mpg123::AudioIO_Mpg123(void)\n:\n\tp(new AudioIO_Mpg123_Private())\n{\n}\n\nAudioIO_Mpg123::~AudioIO_Mpg123(void)\n{\n\tdelete p;\n}\n\nAudioIO_Mpg123_Private::AudioIO_Mpg123_Private(void)\n{\n\tlibraryInit();\n\n\ttempBuff  = NULL;\n\thandle    = NULL;\n\tframeSize = 0;\n\tbuffSize  = 0;\n\n\tmemset(&format, 0, sizeof(struct mpg123_fmt));\n}\n\nAudioIO_Mpg123_Private::~AudioIO_Mpg123_Private(void)\n{\n\tclose();\n\tlibraryExit();\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Public API\n///////////////////////////////////////////////////////////////////////////////\n\nbool AudioIO_Mpg123::openRd(const CHR *const fileName, const uint32_t channels, const uint32_t sampleRate, const uint32_t bitDepth)\n{\n\treturn p->openRd(fileName, channels, sampleRate, bitDepth);\n}\n\nbool AudioIO_Mpg123::openWr(const CHR *const fileName, const uint32_t channels, const uint32_t sampleRate, const uint32_t bitDepth, const CHR *const format)\n{\n\treturn p->openWr(fileName, channels, sampleRate, bitDepth, format);\n}\n\nbool AudioIO_Mpg123::close(void)\n{\n\treturn p->close();\n}\n\nint64_t AudioIO_Mpg123::read(double **buffer, const int64_t count)\n{\n\treturn p->read(buffer, count);\n}\n\nint64_t AudioIO_Mpg123::write(double *const *buffer, const int64_t count)\n{\n\treturn p->write(buffer, count);\n}\n\nbool AudioIO_Mpg123::queryInfo(uint32_t &channels, uint32_t &sampleRate, int64_t &length, uint32_t &bitDepth)\n{\n\treturn p->queryInfo(channels, sampleRate, length, bitDepth);\n}\n\nvoid AudioIO_Mpg123::getFormatInfo(CHR *buffer, const uint32_t buffSize)\n{\n\tp->getFormatInfo(buffer, buffSize);\n}\n\nconst CHR *AudioIO_Mpg123::libraryVersion(void)\n{\n\treturn AudioIO_Mpg123_Private::libraryVersion();\n}\n\nconst CHR *const *AudioIO_Mpg123::supportedFormats(const CHR **const list, const uint32_t maxLen)\n{\n\treturn AudioIO_Mpg123_Private::supportedFormats(list, maxLen);\n}\n\nbool AudioIO_Mpg123::checkFileType(FILE *const file)\n{\n\treturn AudioIO_Mpg123_Private::checkFileType(file);\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Internal Functions\n///////////////////////////////////////////////////////////////////////////////\n\nbool AudioIO_Mpg123_Private::openRd(const CHR *const fileName, const uint32_t channels, const uint32_t sampleRate, const uint32_t bitDepth)\n{\n\tif (handle)\n\t{\n\t\tPRINT_ERR(TXT(\"Sound file is already open!\\n\"));\n\t\treturn false;\n\t}\n\n\t//Create libmpg123 handle\n\tint error = 0;\n\tif (!(handle = mpg123_new(NULL, &error)))\n\t{\n\t\tPRINT2_ERR(TXT(\"Failed to create libmpg123 handle:\\n\") FMT_chr TXT(\"\\n\"), mpg123_plain_strerror(error));\n\t\treturn false;\n\t}\n\n\t//Initialize the libmpg123 flags\n\tlong flags; double fflags;\n\tif (mpg123_getparam(handle, MPG123_FLAGS, &flags, &fflags) == MPG123_OK)\n\t{\n\t\tflags |= MPG123_FORCE_FLOAT;\n\t\tflags |= MPG123_QUIET;\n\t\tif (mpg123_param(handle, MPG123_FLAGS, flags, fflags) != MPG123_OK)\n\t\t{\n\t\t\tPRINT2_ERR(TXT(\"Failed to set up libmpg123 flags: \\\"\") FMT_chr TXT(\"\\\"\\n\"), mpg123_strerror(handle));\n\t\t\tMPG123_DELETE(handle);\n\t\t\treturn false;\n\t\t}\n\t}\n\telse\n\t{\n\t\tPRINT2_ERR(TXT(\"Failed to query libmpg123 flags: \\\"\") FMT_chr TXT(\"\\\"\\n\"), mpg123_strerror(handle));\n\t\tMPG123_DELETE(handle);\n\t\treturn false;\n\t}\n\n\t//Use pipe?\n\tconst bool bStdIn = (STRCASECMP(fileName, TXT(\"-\")) == 0);\n\n\t//Open file in libmpg123\n\tif ((bStdIn ? mpg123_open_fd(handle, STDIN_FILENO) : MPG123OPEN(handle, fileName)) != MPG123_OK)\n\t{\n\t\tPRINT2_ERR(TXT(\"Failed to open file for reading: \\\"\") FMT_chr TXT(\"\\\"\\n\"), mpg123_strerror(handle));\n\t\tMPG123_DELETE(handle);\n\t\treturn false;\n\t}\n\n\t//Detect format info\n\tif (mpg123_getformat(handle, &format.rate, &format.channels, &format.encoding) != MPG123_OK)\n\t{\n\t\tPRINT2_ERR(TXT(\"Failed to get format info from audio file:\\n\") FMT_chr TXT(\"\\n\"), mpg123_strerror(handle));\n\t\tclose();\n\t\treturn false;\n\t}\n\n\t//Ensure that this output format will not change\n\tif ((mpg123_format_none(handle) != MPG123_OK) || (mpg123_format(handle, format.rate, format.channels, format.encoding) != MPG123_OK))\n\t{\n\t\tPRINT2_ERR(TXT(\"Failed to set up output format:\\n\") FMT_chr TXT(\"\\n\"), mpg123_strerror(handle));\n\t\tclose();\n\t\treturn false;\n\t}\n\n\t//Query output buffer size\n\tif ((buffSize = mpg123_outblock(handle)) < 1)\n\t{\n\t\tPRINT2_ERR(TXT(\"Failed to get output buffer size from libmpg123:\\n\") FMT_chr TXT(\"\\n\"), mpg123_strerror(handle));\n\t\tclose();\n\t\treturn false;\n\t}\n\n\t//Compute frame size\n\tframeSize = MPG123_SAMPLESIZE(format.encoding) * format.channels;\n\n\t//Allocate temp buffer\n\ttempBuff = new uint8_t[buffSize];\n\n\treturn true;\n}\n\nbool AudioIO_Mpg123_Private::openWr(const CHR *const fileName, const uint32_t channels, const uint32_t sampleRate, const uint32_t bitDepth, const CHR *const format)\n{\n\treturn false; /*unsupported*/\n}\n\nbool AudioIO_Mpg123_Private::close(void)\n{\n\tbool result = false;\n\n\t//Close audio file\n\tif (handle)\n\t{\n\t\tresult = (MPG123CLOSE(handle) == MPG123_OK);\n\t}\n\n\t//Free handle\n\tMPG123_DELETE(handle);\n\n\t//Clear format info\n\tmemset(&format, 0, sizeof(struct mpg123_fmt));\n\n\t//Free temp buffer\n\tbuffSize = frameSize = 0;\n\tMY_DELETE_ARRAY(tempBuff);\n\treturn result;\n}\n\nint64_t AudioIO_Mpg123_Private::read(double **buffer, const int64_t count)\n{\n\tif (!handle)\n\t{\n\t\tMY_THROW(\"Audio file not currently open!\");\n\t}\n\n\tint64_t offset = 0, remaining = count;\n\tconst int64_t maxRdSize = static_cast<int64_t>(buffSize / frameSize);\n\n\twhile (remaining > 0)\n\t{\n\t\t//Read data\n\t\tconst size_t rdBytes = static_cast<size_t>(std::min(remaining, maxRdSize) * frameSize);\n\t\tsize_t outBytes = 0;\n\t\tif (mpg123_read(handle, tempBuff, rdBytes, &outBytes) != MPG123_OK)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\n\t\t//Deinterleaving\n\t\tconst int64_t rdFrames = (int64_t)(outBytes / frameSize);\n\t\tswitch (format.encoding)\n\t\t{\n\t\tcase MPG123_ENC_FLOAT_32:\n\t\t\tdeinterleave(buffer, offset, reinterpret_cast<const float*> (tempBuff), format.channels, rdFrames);\n\t\t\tbreak;\n\t\tcase MPG123_ENC_FLOAT_64:\n\t\t\tdeinterleave(buffer, offset, reinterpret_cast<const double*>(tempBuff), format.channels, rdFrames);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tPRINT2_ERR(TXT(\"Sample encoding 0x%X is NOT supported!\"), format.encoding);\n\t\t\treturn 0;\n\t\t}\n\n\t\toffset += rdFrames, remaining -= rdFrames;\n\n\t\tif (outBytes < rdBytes)\n\t\t{\n\t\t\tbreak; /*end of file, or read error*/\n\t\t}\n\t}\n\n\t//Zero remaining data\n\tif (remaining > 0)\n\t{\n\t\tfor (int c = 0; c < format.channels; c++)\n\t\t{\n\t\t\tmemset(&buffer[c][offset], 0, sizeof(double) * size_t(remaining));\n\t\t}\n\t}\n\n\treturn count - remaining;\n}\n\nint64_t AudioIO_Mpg123_Private::write(double *const *buffer, const int64_t count)\n{\n\treturn -1; /*unsupported*/\n}\n\nbool AudioIO_Mpg123_Private::queryInfo(uint32_t &channels, uint32_t &sampleRate, int64_t &length, uint32_t &bitDepth)\n{\n\tif (!handle)\n\t{\n\t\tMY_THROW(\"Audio file not currently open!\");\n\t}\n\n\tif (format.channels && format.rate && format.encoding)\n\t{\n\t\tchannels = format.channels;\n\t\tsampleRate = format.rate;\n\t\tif ((length = mpg123_length(handle)) == MPG123_ERR)\n\t\t{\n\t\t\tlength = INT64_MAX;\n\t\t}\n\t\tbitDepth = MPG123_SAMPLESIZE(format.encoding) * 8U;\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n\nvoid AudioIO_Mpg123_Private::getFormatInfo(CHR *buffer, const uint32_t buffSize)\n{\n\tSNPRINTF(buffer, buffSize, TXT(\"MPG123 Audio\"));\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Static Functions\n///////////////////////////////////////////////////////////////////////////////\n\nCHR AudioIO_Mpg123_Private::versionBuffer[256] = { '\\0' };\nMY_CRITSEC_DECL(AudioIO_Mpg123_Private::mutex_lock);\nuint32_t AudioIO_Mpg123_Private::instanceCounter = 0U;\n\nconst CHR *AudioIO_Mpg123_Private::libraryVersion(void)\n{\n\tMY_CRITSEC_ENTER(mutex_lock);\n\tif(!versionBuffer[0])\n\t{\n\t\tSNPRINTF(versionBuffer, 256, TXT(\"libmpg123 API-v%u, written and copyright by Michael Hipp and others.\"), MPG123_API_VERSION);\n\t}\n\tMY_CRITSEC_LEAVE(mutex_lock);\n\treturn versionBuffer;\n}\n\nconst CHR *const *AudioIO_Mpg123_Private::supportedFormats(const CHR **const list, const uint32_t maxLen)\n{\n\tstatic const CHR *const MP3_FORMAT = TXT(\"mp3\");\n\tif (list && (maxLen > 0))\n\t{\n\t\tuint32_t nextPos = 0;\n\t\tlist[nextPos++] = &MP3_FORMAT[0];\n\t\tlist[(nextPos < maxLen) ? nextPos : (maxLen - 1)] = NULL;\n\t}\n\treturn list;\n}\n\nbool AudioIO_Mpg123_Private::checkFileType(FILE *const file)\n{\n\tstatic const uint32_t THRESHOLD = 13U;\n\tstatic const size_t BUFF_SIZE = 128U * 1024U;\n\tuint32_t max_sequence = 0;\n\tuint8_t *buffer = new uint8_t[BUFF_SIZE];\n\tsize_t count = BUFF_SIZE;\n\tfor (int chunk = 0; (chunk < 64) && (count >= BUFF_SIZE); ++chunk)\n\t{\n\t\tif ((count = fread(buffer, sizeof(uint8_t), BUFF_SIZE, file)) >= MPG123_HDR_SIZE)\n\t\t{\n\t\t\tif (checkMpg123Sequence(buffer, count, max_sequence) >= THRESHOLD)\n\t\t\t{\n\t\t\t\tbreak; /*early termination*/\n\t\t\t}\n\t\t}\n\t}\n\tMY_DELETE_ARRAY(buffer);\n\treturn (max_sequence >= THRESHOLD);\n}\n\nuint32_t AudioIO_Mpg123_Private::checkMpg123Sequence(const uint8_t *const buffer, const size_t &count, uint32_t &max_sequence)\n{\n\tconst size_t limit = count - MPG123_HDR_SIZE;\n\tuint32_t sequence_len = 0;\n\tuint8_t prev_idx[3] = { 0, 0, 0 };\n\tsize_t fpos = 0;\n\twhile (fpos < limit)\n\t{\n\t\tif (checkMpg123SyncWord(buffer, fpos))\n\t\t{\n\t\t\tconst uint8_t versn_idx = ((buffer[fpos + 1U] & ((uint8_t)0x08)) >> 3U);\n\t\t\tconst uint8_t layer_idx = ((buffer[fpos + 1U] & ((uint8_t)0x06)) >> 1U);\n\t\t\tconst uint8_t bitrt_idx = ((buffer[fpos + 2U] & ((uint8_t)0xF0)) >> 4U);\n\t\t\tconst uint8_t srate_idx = ((buffer[fpos + 2U] & ((uint8_t)0x0C)) >> 2U);\n\t\t\tconst uint8_t padd_byte = ((buffer[fpos + 2U] & ((uint8_t)0x02)) >> 1U);\n\t\t\tif ((layer_idx > 0x00) && (layer_idx <= 0x03) && (bitrt_idx > 0x00) && (bitrt_idx < 0x0F) && (srate_idx < 0x03))\n\t\t\t{\n\t\t\t\tconst uint32_t bitrt = MPG123_BITRT[versn_idx][layer_idx][bitrt_idx];\n\t\t\t\tconst uint32_t srate = MPG123_SRATE[versn_idx][srate_idx];\n\t\t\t\tconst uint32_t fsize = (MPG123_FSIZE[versn_idx][layer_idx] * bitrt * 1000U / srate) + padd_byte;\n\t\t\t\tif ((sequence_len < 1U) || ((prev_idx[0] == versn_idx) && (prev_idx[1] == layer_idx) && (prev_idx[2] == srate_idx)))\n\t\t\t\t{\n\t\t\t\t\tprev_idx[0] = versn_idx; prev_idx[1] = layer_idx; prev_idx[2] = srate_idx;\n\t\t\t\t\tmax_sequence = std::max(max_sequence, ++sequence_len);\n\t\t\t\t\tif ((fsize > 0) && ((fpos + fsize) < limit) && checkMpg123SyncWord(buffer, fpos + fsize))\n\t\t\t\t\t{\n\t\t\t\t\t\tfpos += fsize;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tsequence_len = 0;\n\t\tprev_idx[0] = prev_idx[1] = prev_idx[2] = 0;\n\t\tfpos++;\n\t}\n\treturn max_sequence;\n}\n\nbool AudioIO_Mpg123_Private::checkMpg123SyncWord(const uint8_t *const buffer, const size_t &fpos)\n{\n\treturn (buffer[fpos] == ((uint8_t)0xFF)) && ((buffer[fpos + 1] & ((uint8_t)0xF0)) == ((uint8_t)0xF0));\n}\n\ntemplate<typename T>\nvoid AudioIO_Mpg123_Private::deinterleave(double **destination, const int64_t offset, const T *const source, const int &channels, const int64_t &len)\n{\n\tfor (int64_t i = 0; i < len; i++)\n\t{\n\t\tfor (int c = 0; c < channels; c++)\n\t\t{\n\t\t\tdestination[c][i + offset] = source[(i * channels) + c];\n\t\t}\n\t}\n}\n\nvoid AudioIO_Mpg123_Private::libraryInit(void)\n{\n\tMY_CRITSEC_ENTER(mutex_lock);\n\tif (!(instanceCounter++))\n\t{\n\t\tif (mpg123_init() != MPG123_OK)\n\t\t{\n\t\t\tabort();\n\t\t}\n\t}\n\tMY_CRITSEC_LEAVE(mutex_lock);\n}\n\nvoid AudioIO_Mpg123_Private::libraryExit(void)\n{\n\tMY_CRITSEC_ENTER(mutex_lock);\n\tif (!(--instanceCounter))\n\t{\n\t\tmpg123_exit();\n\t}\n\tMY_CRITSEC_LEAVE(mutex_lock);\n}"
  },
  {
    "path": "DynamicAudioNormalizerCLI/src/AudioIO_Mpg123.h",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Utility\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This program is free software; you can redistribute it and/or\n// modify it under the terms of the GNU General Public License\n// as published by the Free Software Foundation; either version 2\n// of the License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n//\n// http://www.gnu.org/licenses/gpl-2.0.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#pragma once\n\n#include \"AudioIO.h\"\n\nclass AudioIO_Mpg123_Private;\n\nclass AudioIO_Mpg123 : public AudioIO\n{\npublic:\n\tAudioIO_Mpg123(void);\n\tvirtual ~AudioIO_Mpg123(void);\n\n\t//Open and Close\n\tvirtual bool openRd(const CHR *const fileName, const uint32_t channels, const uint32_t sampleRate, const uint32_t bitDepth);\n\tvirtual bool openWr(const CHR *const fileName, const uint32_t channels, const uint32_t sampleRate, const uint32_t bitDepth, const CHR *const format = NULL);\n\tvirtual bool close(void);\n\n\t//Read and Write\n\tvirtual int64_t read(double **buffer, const int64_t count);\n\tvirtual int64_t write(double *const *buffer, const int64_t count);\n\n\t//Query info\n\tvirtual bool queryInfo(uint32_t &channels, uint32_t &sampleRate, int64_t &length, uint32_t &bitDepth);\n\tvirtual void getFormatInfo(CHR *buffer, const uint32_t buffSize);\n\n\t//Static functions\n\tstatic const CHR *libraryVersion(void);\n\tstatic const CHR *const *supportedFormats(const CHR **const list, const uint32_t maxLen);\n\tstatic bool checkFileType(FILE *const file);\n\tstatic AudioIO *createInstance() { return new AudioIO_Mpg123(); }\n\nprivate:\n\tAudioIO_Mpg123 &operator=(const AudioIO_Mpg123 &) { throw 666; }\n\tAudioIO_Mpg123_Private *const p;\n};\n"
  },
  {
    "path": "DynamicAudioNormalizerCLI/src/AudioIO_OpusFile.cpp",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Utility\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This program is free software; you can redistribute it and/or\n// modify it under the terms of the GNU General Public License\n// as published by the Free Software Foundation; either version 2\n// of the License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n//\n// http://www.gnu.org/licenses/gpl-2.0.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#define __STDC_LIMIT_MACROS\n\n#include \"AudioIO_OpusFile.h\"\n#include <Common.h>\n#include <Threads.h>\n#include <opus.h>\n#include <opusfile.h>\n\n//#include <stdexcept>\n#include <algorithm>\n\n#ifdef __unix\n#include <unistd.h>\n#else\n#define STDIN_FILENO  0\n#define STDOUT_FILENO 1\n#define STDERR_FILENO 2\n#endif\n\n#define OPUS_SRATE 48000U\n#define MY_THROW(X) throw std::runtime_error((X))\n\n///////////////////////////////////////////////////////////////////////////////\n// Private Data\n///////////////////////////////////////////////////////////////////////////////\n\nclass AudioIO_OpusFile_Private\n{\npublic:\n\tAudioIO_OpusFile_Private(void);\n\t~AudioIO_OpusFile_Private(void);\n\n\t//Open and Close\n\tbool openRd(const CHR *const fileName, const uint32_t channels, const uint32_t sampleRate, const uint32_t bitDepth);\n\tbool openWr(const CHR *const fileName, const uint32_t channels, const uint32_t sampleRate, const uint32_t bitDepth, const CHR *const format);\n\tbool close(void);\n\n\t//Read and Write\n\tint64_t read(double **buffer, const int64_t count);\n\tint64_t write(double *const *buffer, const int64_t count);\n\n\t//Query info\n\tbool queryInfo(uint32_t &channels, uint32_t &sampleRate, int64_t &length, uint32_t &bitDepth);\n\tvoid getFormatInfo(CHR *buffer, const uint32_t buffSize);\n\n\t//Library info\n\tstatic const CHR *libraryVersion(void);\n\tstatic const CHR *const *supportedFormats(const CHR **const list, const uint32_t maxLen);\n\tstatic bool checkFileType(FILE *const);\n\nprivate:\n\t//opusfile\n\tOggOpusFile *handle;\n\tOpusFileCallbacks callbacks;\n\tvoid *stream;\n\n\t//properties\n\tint chanCount;\n\tbool downmix;\n\n\t//(De)Interleaving buffer\n\tfloat *tempBuff;\n\tsize_t buffSize;\n\n\t//Library info\n\tstatic MY_CRITSEC_DECL(mutex_lock);\n\tstatic CHR versionBuffer[256];\n\n\t//Helper functions\n\ttemplate<typename T> static void deinterleave(double **destination, const int64_t offset, const T *const source, const int &channels, const int64_t &len);\n};\n\n///////////////////////////////////////////////////////////////////////////////\n// Constructor & Destructor\n///////////////////////////////////////////////////////////////////////////////\n\nAudioIO_OpusFile::AudioIO_OpusFile(void)\n:\n\tp(new AudioIO_OpusFile_Private())\n{\n}\n\nAudioIO_OpusFile::~AudioIO_OpusFile(void)\n{\n\tdelete p;\n}\n\nAudioIO_OpusFile_Private::AudioIO_OpusFile_Private(void)\n{\n\ttempBuff  = NULL;\n\thandle    = NULL;\n\tstream    = NULL;\n\tbuffSize  = 0;\n\tchanCount = 0;\n\tdownmix   = false;\n\n\tmemset(&callbacks, 0, sizeof(OpusFileCallbacks));\n}\n\nAudioIO_OpusFile_Private::~AudioIO_OpusFile_Private(void)\n{\n\tclose();\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Public API\n///////////////////////////////////////////////////////////////////////////////\n\nbool AudioIO_OpusFile::openRd(const CHR *const fileName, const uint32_t channels, const uint32_t sampleRate, const uint32_t bitDepth)\n{\n\treturn p->openRd(fileName, channels, sampleRate, bitDepth);\n}\n\nbool AudioIO_OpusFile::openWr(const CHR *const fileName, const uint32_t channels, const uint32_t sampleRate, const uint32_t bitDepth, const CHR *const format)\n{\n\treturn p->openWr(fileName, channels, sampleRate, bitDepth, format);\n}\n\nbool AudioIO_OpusFile::close(void)\n{\n\treturn p->close();\n}\n\nint64_t AudioIO_OpusFile::read(double **buffer, const int64_t count)\n{\n\treturn p->read(buffer, count);\n}\n\nint64_t AudioIO_OpusFile::write(double *const *buffer, const int64_t count)\n{\n\treturn p->write(buffer, count);\n}\n\nbool AudioIO_OpusFile::queryInfo(uint32_t &channels, uint32_t &sampleRate, int64_t &length, uint32_t &bitDepth)\n{\n\treturn p->queryInfo(channels, sampleRate, length, bitDepth);\n}\n\nvoid AudioIO_OpusFile::getFormatInfo(CHR *buffer, const uint32_t buffSize)\n{\n\tp->getFormatInfo(buffer, buffSize);\n}\n\nconst CHR *AudioIO_OpusFile::libraryVersion(void)\n{\n\treturn AudioIO_OpusFile_Private::libraryVersion();\n}\n\nconst CHR *const *AudioIO_OpusFile::supportedFormats(const CHR **const list, const uint32_t maxLen)\n{\n\treturn AudioIO_OpusFile_Private::supportedFormats(list, maxLen);\n}\n\nbool AudioIO_OpusFile::checkFileType(FILE *const file)\n{\n\treturn AudioIO_OpusFile_Private::checkFileType(file);\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Internal Functions\n///////////////////////////////////////////////////////////////////////////////\n\nbool AudioIO_OpusFile_Private::openRd(const CHR *const fileName, const uint32_t channels, const uint32_t sampleRate, const uint32_t bitDepth)\n{\n\tif (handle)\n\t{\n\t\tPRINT_ERR(TXT(\"OggOpus file is already open!\\n\"));\n\t\treturn false;\n\t}\n\n\t//Open file descriptor\n\tconst int fd = OPEN(fileName, O_RDONLY);\n\tif (fd < 0)\n\t{\n\t\tPRINT2_ERR(TXT(\"Failed to open input file for reading! [error: %d]\\n\"), errno);\n\t\treturn false;\n\t}\n\n\t//Create callbacks\n\tif (!(stream = op_fdopen(&callbacks, fd, \"rb\")))\n\t{\n\t\tPRINT_ERR(TXT(\"Failed to initialize OpusFile callbacks!\\n\"));\n\t\tCLOSE(fd);\n\t\treturn false;\n\t}\n\n\t//Create opusfile handle\n\tint error;\n\tif (!(handle = op_open_callbacks(stream, &callbacks, NULL, 0U, &error)))\n\t{\n\t\tPRINT2_ERR(TXT(\"Failed to open OggOpus file for reading [error: %d]\\n\"), error);\n\t\tcallbacks.close(stream);\n\t\tstream = NULL;\n\t\tmemset(&callbacks, 0, sizeof(OpusFileCallbacks));\n\t\treturn false;\n\t}\n\n\t//Is seekable?\n\tif (op_seekable(handle))\n\t{\n\t\t//Get the number of links\n\t\tconst int linkCount = op_link_count(handle);\n\t\tif (linkCount < 1)\n\t\t{\n\t\t\tMY_THROW(\"Insanity: Link count is zero or negative!\");\n\t\t}\n\n\t\t//Get channel count\n\t\tchanCount = op_channel_count(handle, 0);\n\t\tif (chanCount < 1)\n\t\t{\n\t\t\tMY_THROW(\"Insanity: Channel count is zero or negative!\");\n\t\t}\n\n\t\t//Too many channels for us?\n\t\tdownmix = false;\n\t\tif (chanCount > 8)\n\t\t{\n\t\t\tdownmix = true, chanCount = 2; /*enforce stereo*/\n\t\t}\n\n\t\t//Check consistency of channel count for *all* links\n\t\tif ((!downmix) && (linkCount > 1))\n\t\t{\n\t\t\tfor (int link = 1; link < linkCount; ++link)\n\t\t\t{\n\t\t\t\tconst int chanCountNext = op_channel_count(handle, link);\n\t\t\t\tif (chanCountNext < 1)\n\t\t\t\t{\n\t\t\t\t\tMY_THROW(\"Insanity: Channel count is zero or negative!\");\n\t\t\t\t}\n\t\t\t\tif (chanCountNext != chanCount)\n\t\t\t\t{\n\t\t\t\t\tdownmix = true, chanCount = 2; /*enforce stereo*/\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\t//For non-seekable stream, we can't do anything but enforce stereo!\n\t\tdownmix = true, chanCount = 2;\n\t}\n\n\t//Print warning if downmixing is enabled\n\tif (downmix)\n\t{\n\t\tPRINT_WRN(TXT(\"Opus source has inconsistent channel count -> downminxing to stereo! (\\n\"));\n\t}\n\n\t//Allocate I/O buffer\n\ttempBuff = new float[buffSize = (OPUS_SRATE * chanCount)]; /*1 sec per channel*/\n\n\treturn true;\n}\n\nbool AudioIO_OpusFile_Private::openWr(const CHR *const fileName, const uint32_t channels, const uint32_t sampleRate, const uint32_t bitDepth, const CHR *const format)\n{\n\treturn false; /*unsupported*/\n}\n\nbool AudioIO_OpusFile_Private::close(void)\n{\n\tbool result = false;\n\n\t//Close audio file\n\tif (handle)\n\t{\n\t\top_free(handle);\n\t\tresult = true;\n\t}\n\n\t//Clear callbacks\n\tmemset(&callbacks, 0, sizeof(OpusFileCallbacks));\n\n\t//Free temp buffer\n\tMY_DELETE_ARRAY(tempBuff);\n\tbuffSize = chanCount = 0, downmix = false, handle = NULL, stream = NULL;\n\treturn result;\n}\n\nint64_t AudioIO_OpusFile_Private::read(double **buffer, const int64_t count)\n{\n\tif (!handle)\n\t{\n\t\tMY_THROW(\"Audio file not currently open!\");\n\t}\n\n\tint64_t offset = 0, remaining = count;\n\n\t//Read next chunk of data\n\twhile (remaining > 0)\n\t{\n\t\tint result, link = -1;\n\t\tconst int rdSize = static_cast<int>(std::min(remaining * chanCount, static_cast<int64_t>(buffSize)));\n\n\t\t//Read next chunk of data\n\t\tfor(int retry = 0; retry < 9999; ++retry)\n\t\t{\n\t\t\tresult = downmix ? op_read_float_stereo(handle, tempBuff, rdSize) : op_read_float(handle, tempBuff, rdSize, &link);\n\t\t\tif (result != OP_HOLE)\n\t\t\t{\n\t\t\t\tbreak; /*no more holes*/\n\t\t\t}\n\t\t}\n\n\t\t//Check result for errors\n\t\tif (result <= 0)\n\t\t{\n\t\t\tbreak; /*end of file, or read error*/\n\t\t}\n\n\t\t//Check number of channels\n\t\tif ((!downmix) && (op_channel_count(handle, link) != chanCount))\n\t\t{\n\t\t\tMY_THROW(\"Number of channels inconsistent!\");\n\t\t}\n\n\t\t//Deinterleaving\n\t\tdeinterleave(buffer, offset, tempBuff, chanCount, result);\n\t\toffset += result, remaining -= result;\n\t}\n\n\t//Zero remaining data\n\tif (remaining > 0)\n\t{\n\t\tfor (int c = 0; c < chanCount; c++)\n\t\t{\n\t\t\tmemset(&buffer[c][offset], 0, sizeof(double) * size_t(remaining));\n\t\t}\n\t}\n\n\treturn count - remaining;\n}\n\nint64_t AudioIO_OpusFile_Private::write(double *const *buffer, const int64_t count)\n{\n\treturn -1; /*unsupported*/\n}\n\nbool AudioIO_OpusFile_Private::queryInfo(uint32_t &channels, uint32_t &sampleRate, int64_t &length, uint32_t &bitDepth)\n{\n\tif (!handle)\n\t{\n\t\tMY_THROW(\"Audio file not currently open!\");\n\t}\n\n\t//Try to compute number of samples\n\tconst ogg_int64_t samplesTotal = op_pcm_total(handle, -1);\n\n\t//Set up audio properties\n\tchannels   = (uint32_t)chanCount;\n\tsampleRate = OPUS_SRATE;\n\tlength     = (samplesTotal > 0) ? samplesTotal : INT64_MAX;\n\tbitDepth   = 32U;\n\n\treturn true;\n}\n\nvoid AudioIO_OpusFile_Private::getFormatInfo(CHR *buffer, const uint32_t buffSize)\n{\n\tSNPRINTF(buffer, buffSize, TXT(\"MPG123 Audio\"));\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Static Functions\n///////////////////////////////////////////////////////////////////////////////\n\nCHR AudioIO_OpusFile_Private::versionBuffer[256] = { '\\0' };\nMY_CRITSEC_DECL(AudioIO_OpusFile_Private::mutex_lock);\n\nconst CHR *AudioIO_OpusFile_Private::libraryVersion(void)\n{\n\tMY_CRITSEC_ENTER(mutex_lock);\n\tif(!versionBuffer[0])\n\t{\n\t\tSNPRINTF(versionBuffer, 256, FMT_chr TXT(\", created by the Xiph.Org Foundation and contributors.\"), opus_get_version_string());\n\t}\n\tMY_CRITSEC_LEAVE(mutex_lock);\n\treturn versionBuffer;\n}\n\nconst CHR *const *AudioIO_OpusFile_Private::supportedFormats(const CHR **const list, const uint32_t maxLen)\n{\n\tstatic const CHR *const OPUS_FORMAT = TXT(\"opus\");\n\tif (list && (maxLen > 0))\n\t{\n\t\tuint32_t nextPos = 0;\n\t\tlist[nextPos++] = &OPUS_FORMAT[0];\n\t\tlist[(nextPos < maxLen) ? nextPos : (maxLen - 1)] = NULL;\n\t}\n\treturn list;\n}\n\nbool AudioIO_OpusFile_Private::checkFileType(FILE *const file)\n{\n\tstatic const size_t BUFF_SIZE = 4096U;\n\tuint8_t *buffer = new uint8_t[BUFF_SIZE];\n\tbool result = false;\n\t\n\tconst size_t count = fread(buffer, sizeof(uint8_t), BUFF_SIZE, file);\n\tif (count >= 57U)\n\t{\n\t\tOpusHead head;\n\t\tresult = (op_test(&head, buffer, count) == 0);\n\t}\n\n\tMY_DELETE_ARRAY(buffer);\n\treturn result;\n}\n\ntemplate<typename T>\nvoid AudioIO_OpusFile_Private::deinterleave(double **destination, const int64_t offset, const T *const source, const int &channels, const int64_t &len)\n{\n\tfor (int64_t i = 0; i < len; i++)\n\t{\n\t\tfor (int c = 0; c < channels; c++)\n\t\t{\n\t\t\tdestination[c][i + offset] = source[(i * channels) + c];\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "DynamicAudioNormalizerCLI/src/AudioIO_OpusFile.h",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Utility\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This program is free software; you can redistribute it and/or\n// modify it under the terms of the GNU General Public License\n// as published by the Free Software Foundation; either version 2\n// of the License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n//\n// http://www.gnu.org/licenses/gpl-2.0.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#pragma once\n\n#include \"AudioIO.h\"\n\nclass AudioIO_OpusFile_Private;\n\nclass AudioIO_OpusFile : public AudioIO\n{\npublic:\n\tAudioIO_OpusFile(void);\n\tvirtual ~AudioIO_OpusFile(void);\n\n\t//Open and Close\n\tvirtual bool openRd(const CHR *const fileName, const uint32_t channels, const uint32_t sampleRate, const uint32_t bitDepth);\n\tvirtual bool openWr(const CHR *const fileName, const uint32_t channels, const uint32_t sampleRate, const uint32_t bitDepth, const CHR *const format = NULL);\n\tvirtual bool close(void);\n\n\t//Read and Write\n\tvirtual int64_t read(double **buffer, const int64_t count);\n\tvirtual int64_t write(double *const *buffer, const int64_t count);\n\n\t//Query info\n\tvirtual bool queryInfo(uint32_t &channels, uint32_t &sampleRate, int64_t &length, uint32_t &bitDepth);\n\tvirtual void getFormatInfo(CHR *buffer, const uint32_t buffSize);\n\n\t//Static functions\n\tstatic const CHR *libraryVersion(void);\n\tstatic const CHR *const *supportedFormats(const CHR **const list, const uint32_t maxLen);\n\tstatic bool checkFileType(FILE *const file);\n\tstatic AudioIO *createInstance() { return new AudioIO_OpusFile(); }\n\nprivate:\n\tAudioIO_OpusFile &operator=(const AudioIO_OpusFile &) { throw 666; }\n\tAudioIO_OpusFile_Private *const p;\n};\n"
  },
  {
    "path": "DynamicAudioNormalizerCLI/src/AudioIO_SndFile.cpp",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Utility\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This program is free software; you can redistribute it and/or\n// modify it under the terms of the GNU General Public License\n// as published by the Free Software Foundation; either version 2\n// of the License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n//\n// http://www.gnu.org/licenses/gpl-2.0.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#define __STDC_LIMIT_MACROS\n\n#ifdef _WIN32\n#define ENABLE_SNDFILE_WINDOWS_PROTOTYPES 1\n#define SF_OPEN_FILE(X,Y,Z) sf_wchar_open((X),(Y),(Z))\n#else\n#define SF_OPEN_FILE(X,Y,Z) sf_open((X),(Y),(Z))\n#endif\n\n#include \"AudioIO_SndFile.h\"\n#include <Common.h>\n#include <Threads.h>\n\n#include <sndfile.h>\n#include <stdexcept>\n#include <algorithm>\n\n#include \"3rd_party/memmem.h\"\n\n#ifdef __unix\n#include <unistd.h>\n#else\n#define STDIN_FILENO  0\n#define STDOUT_FILENO 1\n#define STDERR_FILENO 2\n#endif\n\n#define MY_THROW(X) throw std::runtime_error((X))\n\n///////////////////////////////////////////////////////////////////////////////\n// Const\n///////////////////////////////////////////////////////////////////////////////\n\nstatic const struct\n{\n\tconst CHR *const extension[3];\n\tconst int format;\n\tconst int sub_format;\n\tconst bool flag[2];\n}\ng_audio_formats[] =\n{\n\t{ { TXT(\"wav\"),  NULL             }, SF_FORMAT_WAV,  0,                0, 1 },\n\t{ { TXT(\"w64\"),  NULL             }, SF_FORMAT_W64,  0,                0, 1 },\n\t{ { TXT(\"rf64\"), NULL             }, SF_FORMAT_RF64, 0,                0, 1 },\n\t{ { TXT(\"au\"),   NULL             }, SF_FORMAT_AU,   0,                1, 1 },\n\t{ { TXT(\"aiff\"), NULL             }, SF_FORMAT_AIFF, 0,                1, 1 },\n\t{ { TXT(\"ogg\"),  TXT(\"oga\"), NULL }, SF_FORMAT_OGG,  SF_FORMAT_VORBIS, 0, 0 },\n\t{ { TXT(\"flac\"), TXT(\"fla\"), NULL }, SF_FORMAT_FLAC, 0,                1, 0 },\n\t{ { TXT(\"raw\") , TXT(\"pcm\"), NULL }, SF_FORMAT_RAW,  0,                1, 1 },\n\t{ { NULL }, 0, 0, 0, 0 }\n};\n\nstatic const uint32_t CHANNELS_MIN =  1U;\nstatic const uint32_t CHANNELS_MAX = 16U;\n\nstatic const uint32_t SAMPLERATE_MIN =   8000U;\nstatic const uint32_t SAMPLERATE_MAX = 192000U;\n\n///////////////////////////////////////////////////////////////////////////////\n// Private Data\n///////////////////////////////////////////////////////////////////////////////\n\nclass AudioIO_SndFile_Private\n{\npublic:\n\tAudioIO_SndFile_Private(void);\n\t~AudioIO_SndFile_Private(void);\n\n\t//Open and Close\n\tbool openRd(const CHR *const fileName, const uint32_t channels, const uint32_t sampleRate, const uint32_t bitDepth);\n\tbool openWr(const CHR *const fileName, const uint32_t channels, const uint32_t sampleRate, const uint32_t bitDepth, const CHR *const format);\n\tbool close(void);\n\n\t//Read and Write\n\tint64_t read(double **buffer, const int64_t count);\n\tint64_t write(double *const *buffer, const int64_t count);\n\n\t//Query info\n\tbool queryInfo(uint32_t &channels, uint32_t &sampleRate, int64_t &length, uint32_t &bitDepth);\n\tvoid getFormatInfo(CHR *buffer, const uint32_t buffSize);\n\n\t//Library info\n\tstatic const CHR *libraryVersion(void);\n\tstatic const CHR *const *supportedFormats(const CHR **const list, const uint32_t maxLen);\n\tstatic bool checkFileType(FILE *const file);\n\nprivate:\n\t//libsndfile\n\tSF_INFO info;\n\tSNDFILE *handle;\n\tint access;\n\tbool is_pipe;\n\n\t//(De)Interleaving buffer\n\tdouble *tempBuff;\n\tstatic const size_t BUFF_SIZE = 2048;\n\n\t//Library info\n\tstatic MY_CRITSEC_DECL(mutex_lock);\n\tstatic CHR versionBuffer[256];\n\n\t//Helper functions\n\tstatic int formatToBitDepth(const int &format);\n\tstatic int formatFromExtension(const CHR *const fileName, const int &bitDepth);\n\tstatic int getSubFormat(const int &bitDepth, const bool &eightBitIsSigned, const bool &hightBitdepthSupported);\n\tstatic bool checkRawParameters(const uint32_t channels, const uint32_t sampleRate, const uint32_t bitDepth);\n};\n\n///////////////////////////////////////////////////////////////////////////////\n// Constructor & Destructor\n///////////////////////////////////////////////////////////////////////////////\n\nAudioIO_SndFile::AudioIO_SndFile(void)\n:\n\tp(new AudioIO_SndFile_Private())\n{\n}\n\nAudioIO_SndFile::~AudioIO_SndFile(void)\n{\n\tdelete p;\n}\n\nAudioIO_SndFile_Private::AudioIO_SndFile_Private(void)\n{\n\taccess = 0;\n\tis_pipe = false;\n\thandle = NULL;\n\ttempBuff = NULL;\n}\n\nAudioIO_SndFile_Private::~AudioIO_SndFile_Private(void)\n{\n\tclose();\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Public API\n///////////////////////////////////////////////////////////////////////////////\n\nbool AudioIO_SndFile::openRd(const CHR *const fileName, const uint32_t channels, const uint32_t sampleRate, const uint32_t bitDepth)\n{\n\treturn p->openRd(fileName, channels, sampleRate, bitDepth);\n}\n\nbool AudioIO_SndFile::openWr(const CHR *const fileName, const uint32_t channels, const uint32_t sampleRate, const uint32_t bitDepth, const CHR *const format)\n{\n\treturn p->openWr(fileName, channels, sampleRate, bitDepth, format);\n}\n\nbool AudioIO_SndFile::close(void)\n{\n\treturn p->close();\n}\n\nint64_t AudioIO_SndFile::read(double **buffer, const int64_t count)\n{\n\treturn p->read(buffer, count);\n}\n\nint64_t AudioIO_SndFile::write(double *const *buffer, const int64_t count)\n{\n\treturn p->write(buffer, count);\n}\n\nbool AudioIO_SndFile::queryInfo(uint32_t &channels, uint32_t &sampleRate, int64_t &length, uint32_t &bitDepth)\n{\n\treturn p->queryInfo(channels, sampleRate, length, bitDepth);\n}\n\nvoid AudioIO_SndFile::getFormatInfo(CHR *buffer, const uint32_t buffSize)\n{\n\tp->getFormatInfo(buffer, buffSize);\n}\n\nconst CHR *AudioIO_SndFile::libraryVersion(void)\n{\n\treturn AudioIO_SndFile_Private::libraryVersion();\n}\n\nconst CHR *const *AudioIO_SndFile::supportedFormats(const CHR **const list, const uint32_t maxLen)\n{\n\treturn AudioIO_SndFile_Private::supportedFormats(list, maxLen);\n}\n\nbool AudioIO_SndFile::checkFileType(FILE *const file)\n{\n\treturn AudioIO_SndFile_Private::checkFileType(file);\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Internal Functions\n///////////////////////////////////////////////////////////////////////////////\n\nbool AudioIO_SndFile_Private::openRd(const CHR *const fileName, const uint32_t channels, const uint32_t sampleRate, const uint32_t bitDepth)\n{\n\tif(handle)\n\t{\n\t\tPRINT_ERR(TXT(\"Sound file is already open!\\n\"));\n\t\treturn false;\n\t}\n\n\t//Initialize\n\tmemset(&info, 0, sizeof(SF_INFO));\n\n\t//Use pipe?\n\tconst bool bStdIn = (STRCASECMP(fileName, TXT(\"-\")) == 0);\n\tconst bool bPipe = bStdIn && (!FD_ISREG(STDIN_FILENO));\n\t\n\t//Setup info for \"raw\" input\n\tif(bPipe)\n\t{\n\t\tif(!checkRawParameters(channels, sampleRate, bitDepth))\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\tinfo.format = formatFromExtension(TXT(\"raw\"), bitDepth);\n\t\tinfo.channels = channels;\n\t\tinfo.samplerate = sampleRate;\n\t}\n\n\t//Open file in libsndfile\n\thandle = bStdIn ? sf_open_fd(STDIN_FILENO, SFM_READ, &info, SF_FALSE) : SF_OPEN_FILE(fileName, SFM_READ, &info);\n\n\tif(!handle)\n\t{\n\t\tPRINT2_ERR(TXT(\"Failed to open file for reading: \\\"\") FMT_chr TXT(\"\\\"\\n\"), sf_strerror(NULL));\n\t\treturn false;\n\t}\n\n\t//Allocate temp buffer\n\ttempBuff = new double[BUFF_SIZE * info.channels];\n\n\tis_pipe = bPipe;\n\taccess = SFM_READ;\n\treturn true;\n}\n\nbool AudioIO_SndFile_Private::openWr(const CHR *const fileName, const uint32_t channels, const uint32_t sampleRate, const uint32_t bitDepth, const CHR *const format)\n{\n\tif(handle)\n\t{\n\t\tPRINT_ERR(TXT(\"Sound file is already open!\\n\"));\n\t\treturn false;\n\t}\n\n\t//Initialize\n\tmemset(&info, 0, sizeof(SF_INFO));\n\n\t//Use pipe?\n\tconst bool bStdOut = (STRCASECMP(fileName, TXT(\"-\")) == 0);\n\tconst bool bPipe = bStdOut && (!FD_ISREG(STDOUT_FILENO));\n\n\t//Setup output format\n\tinfo.format = format ? formatFromExtension(format, bitDepth) : formatFromExtension(bPipe ? TXT(\"raw\") : fileName, bitDepth);\n\tinfo.channels = channels;\n\tinfo.samplerate = sampleRate;\n\n\t//Open file in libsndfile\n\thandle = bStdOut ? sf_open_fd(STDOUT_FILENO, SFM_WRITE, &info, SF_FALSE) : SF_OPEN_FILE(fileName, SFM_WRITE, &info);\n\n\tif(!handle)\n\t{\n\t\tPRINT2_ERR(TXT(\"Failed to open file for writing: \\\"\") FMT_chr TXT(\"\\\"\\n\"), sf_strerror(NULL));\n\t\treturn false;\n\t}\n\n\t//Allocate temp buffer\n\ttempBuff = new double[BUFF_SIZE * info.channels];\n\n\t//Set Vorbis quality\n\tif((info.format & SF_FORMAT_SUBMASK) == SF_FORMAT_VORBIS)\n\t{\n\t\tdouble vorbisQualityLevel = 0.6;\n\t\tsf_command(handle, SFC_SET_VBR_ENCODING_QUALITY, &vorbisQualityLevel, sizeof(double));\n\t}\n\n\tis_pipe = bPipe;\n\taccess = SFM_WRITE;\n\treturn true;\n}\n\nbool AudioIO_SndFile_Private::close(void)\n{\n\tbool result = false;\n\n\t//Close sndfile\n\tif(handle)\n\t{\n\t\tsf_close(handle);\n\t\thandle = NULL;\n\t\tresult = true;\n\t}\n\n\t//Free temp buffer\n\tMY_DELETE_ARRAY(tempBuff);\n\n\t//Clear sndfile status\n\taccess = 0;\n\tmemset(&info, 0, sizeof(SF_INFO));\n\t\n\treturn result;\n}\n\nint64_t AudioIO_SndFile_Private::read(double **buffer, const int64_t count)\n{\n\tif(!handle)\n\t{\n\t\tMY_THROW(\"Audio file not currently open!\");\n\t}\n\tif(access != SFM_READ)\n\t{\n\t\tMY_THROW(\"Audio file not open in READ mode!\");\n\t}\n\n\tsf_count_t offset    = 0;\n\tsf_count_t remaining = count;\n\n\twhile(remaining > 0)\n\t{\n\t\t//Read data\n\t\tconst sf_count_t rdSize = std::min(remaining, int64_t(BUFF_SIZE));\n\t\tconst sf_count_t result = sf_readf_double(handle, tempBuff, rdSize);\n\n\t\t//Deinterleaving\n\t\tfor(sf_count_t i = 0; i < result; i++)\n\t\t{\n\t\t\tfor(int c = 0; c < info.channels; c++)\n\t\t\t{\n\t\t\t\tbuffer[c][i + offset] = tempBuff[(i * info.channels) + c];\n\t\t\t}\n\t\t}\n\n\t\toffset    += result;\n\t\tremaining -= result;\n\n\t\tif(result < rdSize)\n\t\t{\n\t\t\tbreak; /*end of file, or read error*/\n\t\t}\n\t}\n\n\t//Zero remaining data\n\tif(remaining > 0)\n\t{\n\t\tfor(int c = 0; c < info.channels; c++)\n\t\t{\n\t\t\tmemset(&buffer[c][offset], 0, sizeof(double) * size_t(remaining));\n\t\t}\n\t}\n\n\treturn count - remaining;\n}\n\nint64_t AudioIO_SndFile_Private::write(double *const *buffer, const int64_t count)\n{\n\tif(!handle)\n\t{\n\t\tMY_THROW(\"Audio file not currently open!\");\n\t}\n\tif(access != SFM_WRITE)\n\t{\n\t\tMY_THROW(\"Audio file not open in WRITE mode!\");\n\t}\n\n\tsf_count_t offset    = 0;\n\tsf_count_t remaining = count;\n\n\twhile(remaining > 0)\n\t{\n\t\tconst sf_count_t wrSize = std::min(remaining, int64_t(BUFF_SIZE));\n\n\t\t//Interleave data\n\t\tfor(sf_count_t i = 0; i < wrSize; i++)\n\t\t{\n\t\t\tfor(int c = 0; c < info.channels; c++)\n\t\t\t{\n\t\t\t\ttempBuff[(i * info.channels) + c] = buffer[c][i + offset];\n\t\t\t}\n\t\t}\n\n\t\t//Write data\n\t\tconst sf_count_t result = sf_writef_double(handle, tempBuff, wrSize);\n\n\t\toffset    += result;\n\t\tremaining -= result;\n\n\t\tif(result < wrSize)\n\t\t{\n\t\t\tPRINT_WRN(TXT(\"File write error. Wrote fewer frames that what was requested!\"));\n\t\t\tbreak;\n\t\t}\n\t}\n\t\n\treturn count - remaining;\n}\n\nbool AudioIO_SndFile_Private::queryInfo(uint32_t &channels, uint32_t &sampleRate, int64_t &length, uint32_t &bitDepth)\n{\n\tif(!handle)\n\t{\n\t\tMY_THROW(\"Audio file not currently open!\");\n\t}\n\n\tchannels = info.channels;\n\tsampleRate = info.samplerate;\n\tlength = (is_pipe) ? INT64_MAX : info.frames;\n\tbitDepth = formatToBitDepth(info.format);\n\n\treturn true;\n}\n\nvoid AudioIO_SndFile_Private::getFormatInfo(CHR *buffer, const uint32_t buffSize)\n{\n\tconst CHR *format = TXT(\"Unknown Format\");\n\tconst CHR *subfmt = TXT(\"Unknown SubFmt\");\n\n\tswitch(info.format & SF_FORMAT_TYPEMASK)\n\t{\n\t\tcase SF_FORMAT_WAV:    format = TXT(\"RIFF WAVE\"); break;\n\t\tcase SF_FORMAT_AIFF:   format = TXT(\"AIFF\");      break;\n\t\tcase SF_FORMAT_AU:     format = TXT(\"AU/SND\");    break;\n\t\tcase SF_FORMAT_RAW:    format = TXT(\"Raw Data\");  break;\n\t\tcase SF_FORMAT_W64:    format = TXT(\"Wave64\");    break;\n\t\tcase SF_FORMAT_WAVEX:  format = TXT(\"WAVE EX\");   break;\n\t\tcase SF_FORMAT_FLAC:   format = TXT(\"FLAC\");      break;\n\t\tcase SF_FORMAT_OGG:    format = TXT(\"Ogg\");       break;\n\t\tcase SF_FORMAT_RF64:   format = TXT(\"RF64\");      break;\n\t}\n\n\tswitch(info.format & SF_FORMAT_SUBMASK)\n\t{\n\t\tcase SF_FORMAT_PCM_S8: subfmt = TXT(\"8-Bit Signed\");          break;\n\t\tcase SF_FORMAT_PCM_U8: subfmt = TXT(\"8-Bit Unsigned\");        break;\n\t\tcase SF_FORMAT_PCM_16: subfmt = TXT(\"16-Bit Integer\");        break;\n\t\tcase SF_FORMAT_PCM_24: subfmt = TXT(\"24-Bit Integer\");        break;\n\t\tcase SF_FORMAT_PCM_32: subfmt = TXT(\"32-Bit Integer\");        break;\n\t\tcase SF_FORMAT_FLOAT:  subfmt = TXT(\"32-Bit Floating-Point\"); break;\n\t\tcase SF_FORMAT_DOUBLE: subfmt = TXT(\"64-Bit Floating-Point\"); break;\n\t\tcase SF_FORMAT_VORBIS: subfmt = TXT(\"Xiph Vorbis\");           break;\n\t}\n\n\tSNPRINTF(buffer, buffSize, FMT_CHR TXT(\", \") FMT_CHR, format, subfmt);\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Static Functions\n///////////////////////////////////////////////////////////////////////////////\n\nCHR AudioIO_SndFile_Private::versionBuffer[256] = { TXT('\\0') };\nMY_CRITSEC_INIT(AudioIO_SndFile_Private::mutex_lock);\n\nconst CHR *AudioIO_SndFile_Private::libraryVersion(void)\n{\n\tMY_CRITSEC_ENTER(mutex_lock);\n\tif(!versionBuffer[0])\n\t{\n\t\tchar temp[128] = { '\\0' };\n\t\tsf_command(NULL, SFC_GET_LIB_VERSION, temp, sizeof(temp));\n\t\tSNPRINTF(versionBuffer, 256, FMT_chr TXT(\", by Erik de Castro Lopo <erikd@mega-nerd.com>.\"), temp);\n\t}\n\tMY_CRITSEC_LEAVE(mutex_lock);\n\treturn versionBuffer;\n}\n\nconst CHR *const *AudioIO_SndFile_Private::supportedFormats(const CHR **const list, const uint32_t maxLen)\n{\n\tif (list && (maxLen > 0))\n\t{\n\t\tuint32_t nextPos = 0;\n\t\tfor (size_t i = 0; g_audio_formats[i].format; ++i)\n\t\t{\n\t\t\tif (g_audio_formats[i].extension[0] && (nextPos < maxLen))\n\t\t\t{\n\t\t\t\tlist[nextPos++] = g_audio_formats[i].extension[0];\n\t\t\t}\n\t\t}\n\t\tlist[(nextPos < maxLen) ? nextPos : (maxLen - 1)] = NULL;\n\t}\n\treturn list;\n}\n\nbool AudioIO_SndFile_Private::checkFileType(FILE *const file)\n{\n\tstatic const size_t BUFF_SIZE = 256;\n\tuint8_t buffer[BUFF_SIZE];\n\tconst size_t count = fread(buffer, sizeof(uint8_t), BUFF_SIZE, file);\n\tif (count >= BUFF_SIZE)\n\t{\n\t\tif (((memcmp(&buffer[0], \"RIFF\", 4) == 0) || (memcmp(&buffer[0], \"RF64\", 4) == 0)) && (memcmp(&buffer[8], \"WAVE\", 4) == 0))\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\tif ((memcmp(&buffer[0], \"riff\\x2E\\x91\\xCF\\x11\\xA5\\xD6\\x28\\xDB\\x04\\xC1\\x00\\x00\", 16) == 0) && (memcmp(&buffer[24], \"wave\\xF3\\xAC\\xD3\\x11\\x8C\\xD1\\x00\\xC0\\x4F\\x8E\\xDB\\x8A\", 16) == 0))\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\tif ((memcmp(&buffer[0], \"FORM\", 4U) == 0) && (memcmp(&buffer[8], \"AIFF\", 4U) == 0))\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\tif ((memcmp(&buffer[0], \"fLaC\\0\", 5U) == 0) || (memcmp(&buffer[0], \".snd\\0\", 5U) == 0))\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\tif (const uint8_t *pos_oggs = (const uint8_t*)memmem(&buffer[0], count, \"OggS\\0\", 5))\n\t\t{\n\t\t\tif (memmem(pos_oggs + 5, count - ((pos_oggs + 5) - &buffer[0]), \"vorbis\", 6) != NULL)\n\t\t\t{\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}\n\treturn false;\n}\n\nint AudioIO_SndFile_Private::formatToBitDepth(const int &format)\n{\n\tswitch(format & SF_FORMAT_SUBMASK)\n\t{\n\tcase SF_FORMAT_PCM_S8:\n\tcase SF_FORMAT_PCM_U8:\n\t\treturn 8;\n\tcase SF_FORMAT_PCM_16:\n\t\treturn 16;\n\tcase SF_FORMAT_PCM_24:\n\t\treturn 24;\n\tcase SF_FORMAT_PCM_32:\n\tcase SF_FORMAT_FLOAT:\n\t\treturn 32;\n\tcase SF_FORMAT_DOUBLE:\n\t\treturn 64;\n\tdefault:\n\t\treturn 16;\n\t}\n}\n\nint AudioIO_SndFile_Private::formatFromExtension(const CHR *const fileName, const int &bitDepth)\n{\n\tconst CHR *ext = fileName;\n\n\tif(const CHR *tmp = STRRCHR(ext, TXT('/' ))) ext = ++tmp;\n\tif(const CHR *tmp = STRRCHR(ext, TXT('\\\\'))) ext = ++tmp;\n\tif(const CHR *tmp = STRRCHR(ext, TXT('.' ))) ext = ++tmp;\n\n\tfor (size_t i = 0; g_audio_formats[i].format; ++i)\n\t{\n\t\tfor (size_t j = 0; g_audio_formats[i].extension[j]; ++j)\n\t\t{\n\t\t\tif (STRCASECMP(ext, g_audio_formats[i].extension[j]) == 0)\n\t\t\t{\n\t\t\t\treturn g_audio_formats[i].format | (g_audio_formats[i].sub_format ? g_audio_formats[i].sub_format :\n\t\t\t\t\tgetSubFormat(bitDepth, g_audio_formats[i].flag[0], g_audio_formats[i].flag[1]));\n\t\t\t}\n\t\t}\n\t}\n\n\treturn SF_FORMAT_WAV | getSubFormat(bitDepth, 0, 1);\n}\n\nint AudioIO_SndFile_Private::getSubFormat(const int &bitDepth, const bool &eightBitIsSigned, const bool &hightBitdepthSupported)\n{\n\tint format = 0;\n\n\tswitch(bitDepth)\n\t{\n\tcase 8:\n\t\tformat = eightBitIsSigned ? SF_FORMAT_PCM_S8 : SF_FORMAT_PCM_U8;\n\t\tbreak;\n\tcase 16:\n\t\tformat = SF_FORMAT_PCM_16;\n\t\tbreak;\n\tcase 24:\n\t\tformat = SF_FORMAT_PCM_24;\n\t\tbreak;\n\tcase 32:\n\t\tformat = hightBitdepthSupported ? SF_FORMAT_FLOAT  : SF_FORMAT_PCM_24;\n\t\tbreak;\n\tcase 64:\n\t\tformat = hightBitdepthSupported ? SF_FORMAT_DOUBLE : SF_FORMAT_PCM_24;\n\t\tbreak;\n\tdefault:\n\t\tformat = SF_FORMAT_PCM_16;\n\t\tbreak;\n\t}\n\n\treturn format;\n}\n\nbool AudioIO_SndFile_Private::checkRawParameters(const uint32_t channels, const uint32_t sampleRate, const uint32_t bitDepth)\n{\n\tif((channels < CHANNELS_MIN) || (channels > CHANNELS_MAX))\n\t{\n\t\tPRINT2_ERR(TXT(\"Invalid number of channels (%u). Must be in the %u to %u range!\\n\"), channels, CHANNELS_MIN, CHANNELS_MAX);\n\t\treturn false;\n\t}\n\n\tif((sampleRate < SAMPLERATE_MIN) || (sampleRate > SAMPLERATE_MAX))\n\t{\n\t\tPRINT2_ERR(TXT(\"Invalid sampele rate (%u). Must be in the %u to %u range!\\n\"), sampleRate, SAMPLERATE_MIN, SAMPLERATE_MAX);\n\t\treturn false;\n\t}\n\n\tif((bitDepth != 8U) && (bitDepth != 16U) && (bitDepth != 24U) && (bitDepth != 32U) && (bitDepth != 64U))\n\t{\n\t\tPRINT2_ERR(TXT(\"Invalid bit depth (%u). Only 8, 16, 24, 32 and 64 bits/sample are supported!\\n\"), bitDepth);\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n"
  },
  {
    "path": "DynamicAudioNormalizerCLI/src/AudioIO_SndFile.h",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Utility\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This program is free software; you can redistribute it and/or\n// modify it under the terms of the GNU General Public License\n// as published by the Free Software Foundation; either version 2\n// of the License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n//\n// http://www.gnu.org/licenses/gpl-2.0.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#pragma once\n\n#include \"AudioIO.h\"\n\nclass AudioIO_SndFile_Private;\n\nclass AudioIO_SndFile : public AudioIO\n{\npublic:\n\tAudioIO_SndFile(void);\n\tvirtual ~AudioIO_SndFile(void);\n\n\t//Open and Close\n\tvirtual bool openRd(const CHR *const fileName, const uint32_t channels, const uint32_t sampleRate, const uint32_t bitDepth);\n\tvirtual bool openWr(const CHR *const fileName, const uint32_t channels, const uint32_t sampleRate, const uint32_t bitDepth, const CHR *const format = NULL);\n\tvirtual bool close(void);\n\n\t//Read and Write\n\tvirtual int64_t read(double **buffer, const int64_t count);\n\tvirtual int64_t write(double *const *buffer, const int64_t count);\n\n\t//Query info\n\tvirtual bool queryInfo(uint32_t &channels, uint32_t &sampleRate, int64_t &length, uint32_t &bitDepth);\n\tvirtual void getFormatInfo(CHR *buffer, const uint32_t buffSize);\n\n\t//Static functions\n\tstatic const CHR *libraryVersion(void);\n\tstatic const CHR *const *supportedFormats(const CHR **const list, const uint32_t maxLen);\n\tstatic bool checkFileType(FILE *const file);\n\tstatic AudioIO *createInstance() { return new AudioIO_SndFile(); }\n\t\nprivate:\n\tAudioIO_SndFile &operator=(const AudioIO_SndFile &) { throw 666; }\n\tAudioIO_SndFile_Private *const p;\n};\n"
  },
  {
    "path": "DynamicAudioNormalizerCLI/src/Main.cpp",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Utility\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This program is free software; you can redistribute it and/or\n// modify it under the terms of the GNU General Public License\n// as published by the Free Software Foundation; either version 2\n// of the License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n//\n// http://www.gnu.org/licenses/gpl-2.0.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#ifndef __STDC_FORMAT_MACROS\n#define __STDC_FORMAT_MACROS 1\n#endif\n\n//Internal\n#include \"Common.h\"\n#include \"Platform.h\"\n#include \"Parameters.h\"\n#include \"AudioIO.h\"\n\n//MDynamicAudioNormalizer API\n#include \"DynamicAudioNormalizer.h\"\n\n//VLD\n#ifdef _MSC_VER\n#include <vld.h>\n#endif\n\n//C++\n#include <ctime>\n#include <algorithm>\n#include <cmath>\n#include <inttypes.h>\n\n//Linkage\n#ifdef MDYNAMICAUDIONORMALIZER_STATIC\n\tstatic const CHR *LINKAGE = TXT(\"Static\");\n#else\n\tstatic const CHR *LINKAGE = TXT(\"Shared\");\n#endif\n\n//Utility macros\n#define BOOLIFY(X) ((X) ? TXT(\"on\") : TXT(\"off\"))\n#define FILENAME_SRC(X) (STRCASECMP((X), TXT(\"-\")) ? (X) : TXT(\"<STDIN>\"))\n#define FILENAME_OUT(X) (STRCASECMP((X), TXT(\"-\")) ? (X) : TXT(\"<STDOUT>\"))\n\n//Const\nstatic const size_t FRAME_SIZE = 4096;\n\nstatic const CHR *appName(const CHR* argv0)\n{\n\tconst CHR *appName  = argv0;\n\twhile(const CHR *temp = STRCHR(appName, TXT('/' ))) appName = &temp[1];\n\twhile(const CHR *temp = STRCHR(appName, TXT('\\\\'))) appName = &temp[1];\n\treturn appName;\n}\n\nstatic const CHR *timeToString(CHR *timeBuffer, const size_t buffSize, const int64_t &length, const uint32_t &sampleRate)\n{\n\tif(length != INT64_MAX)\n\t{\n\t\tdouble durationInt;\n\t\tdouble durationFrc = modf(double(length) / double(sampleRate), &durationInt);\n\n\t\tconst uint32_t msc = uint32_t(durationFrc * 1000.0);\n\t\tconst uint32_t sec = uint32_t(durationInt) % 60;\n\t\tconst uint32_t min = (uint32_t(durationInt) / 60) % 60;\n\t\tconst uint32_t hrs = uint32_t(durationInt) / 3600;\n\n\t\tSNPRINTF(timeBuffer, buffSize, TXT(\"%u:%02u:%02u.%03u\"), hrs, min, sec, msc);\n\t}\n\telse\n\t{\n\t\tSNPRINTF(timeBuffer, buffSize, TXT(\"Unknown\"));\n\t}\n\n\treturn timeBuffer;\n}\n\nstatic void loggingCallback_default(const int logLevel, const char *const message)\n{\n\tswitch(logLevel)\n\t{\n\tcase MDynamicAudioNormalizer::LOG_LEVEL_WRN:\n\t\tPRINT2_WRN(FMT_chr, message);\n\t\tbreak;\n\tcase MDynamicAudioNormalizer::LOG_LEVEL_ERR:\n\t\tPRINT2_ERR(FMT_chr, message);\n\t\tbreak;\n\t}\n}\n\nstatic void loggingCallback_verbose(const int logLevel, const char *const message)\n{\n\tswitch(logLevel)\n\t{\n\tcase MDynamicAudioNormalizer::LOG_LEVEL_DBG:\n\t\tPRINT2_NFO(FMT_chr, message);\n\t\tbreak;\n\tcase MDynamicAudioNormalizer::LOG_LEVEL_WRN:\n\t\tPRINT2_WRN(FMT_chr, message);\n\t\tbreak;\n\tcase MDynamicAudioNormalizer::LOG_LEVEL_ERR:\n\t\tPRINT2_ERR(FMT_chr, message);\n\t\tbreak;\n\t}\n}\n\nstatic bool openFiles(const Parameters &parameters, AudioIO **sourceFile, AudioIO **outputFile)\n{\n\tuint32_t channels = 0, sampleRate = 0, bitDepth = 0;\n\tint64_t length = 0;\n\n\tMY_DELETE(*sourceFile);\n\tMY_DELETE(*outputFile);\n\n\t//Auto-detect source file type\n\tconst CHR *sourceLibrary = parameters.sourceLibrary();\n\tif (!(sourceLibrary && sourceLibrary[0]))\n\t{\n\t\tsourceLibrary = AudioIO::detectSourceType(parameters.sourceFile(), parameters.verboseMode());\n\t}\n\n\t//Print Audio I/O information\n\tPRINT(TXT(\"Using \") FMT_CHR TXT(\"\\n\\n\"), AudioIO::getLibraryVersion(sourceLibrary));\n\tPRINT(TXT(\"SourceFile: \") FMT_CHR TXT(\"\\n\"),   FILENAME_SRC(parameters.sourceFile()));\n\tPRINT(TXT(\"OutputFile: \") FMT_CHR TXT(\"\\n\\n\"), FILENAME_OUT(parameters.outputFile()));\n\n\t//Open *source* file\n\t*sourceFile = AudioIO::createInstance(sourceLibrary);\n\tif(!(*sourceFile)->openRd(parameters.sourceFile(), parameters.inputChannels(), parameters.inputSampleRate(), parameters.inputBitDepth()))\n\t{\n\t\tPRINT2_WRN(TXT(\"Failed to open input file \\\"\") FMT_CHR TXT(\"\\\" for reading!\\n\"), FILENAME_SRC(parameters.sourceFile()));\n\t\tMY_DELETE(*sourceFile);\n\t\treturn false;\n\t}\n\t\n\t//Query file properties\n\tif((*sourceFile)->queryInfo(channels, sampleRate, length, bitDepth))\n\t{\n\t\tCHR timeBuffer[32];\n\t\tPRINT(TXT(\"Properties: %u channels, %u Hz, %u bit/sample (Duration: \") FMT_CHR TXT(\")\\n\\n\"), channels, sampleRate, bitDepth, timeToString(timeBuffer, 32, length, sampleRate));\n\t}\n\telse\n\t{\n\t\tPRINT_WRN(TXT(\"Failed to determine source file properties!\\n\"));\n\t\tMY_DELETE(*sourceFile);\n\t\treturn false;\n\t}\n\n\t//Open *output* file\n\t*outputFile = AudioIO::createInstance();\n\tif(!(*outputFile)->openWr(parameters.outputFile(), channels, sampleRate, parameters.outputBitDepth() ? parameters.outputBitDepth() : bitDepth, parameters.outputFormat()))\n\t{\n\t\tPRINT2_WRN(TXT(\"Failed to open output file \\\"\") FMT_CHR TXT(\"\\\" for writing!\\n\"), FILENAME_OUT(parameters.outputFile()));\n\t\tMY_DELETE(*sourceFile);\n\t\tMY_DELETE(*outputFile);\n\t\treturn false;\n\t}\n\n\tif(parameters.verboseMode())\n\t{\n\t\tCHR info[128];\n\t\t(*sourceFile)->getFormatInfo(info, 128);\n\t\tPRINT(TXT(\"SourceInfo: \") FMT_CHR TXT(\"\\n\"), info);\n\t\t(*outputFile)->getFormatInfo(info, 128);\n\t\tPRINT(TXT(\"OutputInfo: \") FMT_CHR TXT(\"\\n\\n\"), info);\n\t}\n\n\treturn true;\n}\n\nstatic void printProgress(const int64_t &length, const int64_t &remaining, short &spinnerPos, bool done = false)\n{\n\tstatic const CHR spinner[4] = { TXT('-'), TXT('\\\\'), TXT('|'), TXT('/') };\n\t\n\tif(length != INT64_MAX)\n\t{\n\t\tconst double progress = 99.99 * (double(length - remaining) / double(length));\n\t\tPRINT(TXT(\"\\rNormalization in progress: %5.1f%% [%c]\"), done ? std::max(progress, 100.0) : progress, done ? TXT('*') : spinner[spinnerPos++]);\n\t}\n\telse\n\t{\n\t\tPRINT(TXT(\"\\rNormalization in progress... [%c]\"), done ? TXT('*') : spinner[spinnerPos++]);\n\t}\n\n\tspinnerPos %= 4;\n\tFLUSH();\n}\n\nstatic int processingLoop(MDynamicAudioNormalizer *normalizer, AudioIO *const sourceFile, AudioIO *const outputFile, double **buffer, const uint32_t channels, const int64_t length)\n{\n\t//Init status variables\n\tint64_t remaining = length;\n\tshort indicator = 0, spinnerPos = 1;\n\tbool error = false;\n\n\t//Print progress\n\tprintProgress(length, remaining, spinnerPos);\n\n\t//Main audio processing loop\n\tfor(;;)\n\t{\n\t\tif((++indicator >= 256))\n\t\t{\n\t\t\tprintProgress(length, remaining, spinnerPos);\n\t\t\tindicator = 0; \n\t\t}\n\n\t\tconst int64_t samplesRead = sourceFile->read(buffer, int64_t(FRAME_SIZE));\n\t\tif(samplesRead > 0)\n\t\t{\n\t\t\tif(length != INT64_MAX)\n\t\t\t{\n\t\t\t\tremaining -= samplesRead;\n\t\t\t}\n\n\t\t\tint64_t outputSize;\n\t\t\tif (!normalizer->processInplace(buffer, samplesRead, outputSize))\n\t\t\t{\n\t\t\t\terror = true;\n\t\t\t\tbreak; /*internal error*/\n\t\t\t}\n\n\t\t\tif(outputSize > 0)\n\t\t\t{\n\t\t\t\tif(outputFile->write(buffer, outputSize) != outputSize)\n\t\t\t\t{\n\t\t\t\t\terror = true;\n\t\t\t\t\tbreak; /*write error must have ocurred*/\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif(samplesRead < int64_t(FRAME_SIZE))\n\t\t{\n\t\t\tbreak; /*end of file*/\n\t\t}\n\t}\n\n\t//Flush all the delayed samples\n\twhile (!error)\n\t{\n\t\tint64_t outputSize;\n\t\tif (!normalizer->flushBuffer(buffer, int64_t(FRAME_SIZE), outputSize))\n\t\t{\n\t\t\terror = true;\n\t\t\tbreak; /*internal error*/\n\t\t}\n\n\t\tif (outputSize > 0)\n\t\t{\n\t\t\tif (outputFile->write(buffer, outputSize) != outputSize)\n\t\t\t{\n\t\t\t\terror = true;\n\t\t\t\tbreak; /*write error must have ocurred*/\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tbreak; /*no more pending samples*/\n\t\t}\n\t}\n\n\t//Completed\n\tprintProgress(length, remaining, spinnerPos, (!error));\n\tPRINT(TXT(\"\\n\") FMT_CHR TXT(\".\\n\\n\"), error ? TXT(\"Aborted\") : TXT(\"Finished\"));\n\n\t//Check remaining samples\n\tif (!error)\n\t{\n\t\tconst int64_t samples_delta = (length != INT64_MAX) ? abs(remaining) : (-1);\n\t\tif (samples_delta > 0)\n\t\t{\n\t\t\tconst double delta_fract = double(samples_delta) / double(length);\n\t\t\tif (!(error = (delta_fract >= 0.25)))\n\t\t\t{\n\t\t\t\tPRINT2_WRN(TXT(\"Audio reader got %g (~%.1f%%) \") FMT_CHR TXT(\" samples than projected!\\n\"), double(samples_delta), 100.0 * delta_fract, (remaining > 0) ? TXT(\"less\") : TXT(\"more\"));\n\t\t\t}\n\t\t}\n\t}\n\n\t//Error checking\n\tif(error)\n\t{\n\t\tPRINT_ERR(TXT(\"I/O error encountered -> stopping!\\n\"));\n\t}\n\n\treturn error ? EXIT_FAILURE : EXIT_SUCCESS;\n}\n\nstatic int processFiles(const Parameters &parameters, AudioIO *const sourceFile, AudioIO *const outputFile, FILE *const logFile)\n{\n\tint exitCode = EXIT_SUCCESS;\n\n\t//Get source info\n\tuint32_t channels, sampleRate, bitDepth;\n\tint64_t length;\n\tif(!sourceFile->queryInfo(channels, sampleRate, length, bitDepth))\n\t{\n\t\tPRINT_WRN(TXT(\"Failed to determine source file properties!\\n\"));\n\t\treturn EXIT_FAILURE;\n\t}\n\n\t//Create the normalizer instance\n\tMDynamicAudioNormalizer *normalizer = new MDynamicAudioNormalizer\n\t(\n\t\tchannels,\n\t\tsampleRate,\n\t\tparameters.frameLenMsec(),\n\t\tparameters.filterSize(),\n\t\tparameters.peakValue(),\n\t\tparameters.maxAmplification(),\n\t\tparameters.targetRms(),\n\t\tparameters.compressFactor(),\n\t\tparameters.channelsCoupled(),\n\t\tparameters.enableDCCorrection(),\n\t\tparameters.altBoundaryMode(),\n\t\tlogFile\n\t);\n\t\n\t//Initialze normalizer\n\tif(!normalizer->initialize())\n\t{\n\t\tPRINT_ERR(TXT(\"Failed to initialize the normalizer instance!\\n\"));\n\t\tMY_DELETE(normalizer);\n\t\treturn EXIT_FAILURE;\n\t}\n\n\t//Allocate buffers\n\tdouble **buffer = new double*[channels];\n\tfor(uint32_t channel = 0; channel < channels; channel++)\n\t{\n\t\tbuffer[channel] = new double[FRAME_SIZE];\n\t}\n\t\n\t//Some extra spacing in VERBOSE mode\n\tif(parameters.verboseMode())\n\t{\n\t\tPRINT(TXT(\"\\n\"));\n\t}\n\n\t//Run normalizer now!\n\texitCode = processingLoop(normalizer, sourceFile, outputFile, buffer, channels, length);\n\n\t//Destroy the normalizer\n\tMY_DELETE(normalizer);\n\n\t//Memory clean-up\n\tfor(uint32_t channel = 0; channel < channels; channel++)\n\t{\n\t\tMY_DELETE_ARRAY(buffer[channel]);\n\t}\n\tMY_DELETE_ARRAY(buffer);\n\n\t//Some extra spacing in VERBOSE mode\n\tif(parameters.verboseMode())\n\t{\n\t\tPRINT(TXT(\"\\n\"));\n\t}\n\n\t//Return result\n\treturn exitCode;\n}\n\nstatic void printHelpScreen(int argc, CHR* argv[])\n{\n\tParameters defaults;\n\n\tPUTS (TXT(\"Basic Usage:\\n\"));\n\tPRINT(TXT(\"  \") FMT_CHR TXT(\" [options] -i <input.wav> -o <output.wav>\\n\"), appName(argv[0]));\n\tPUTS (TXT(\"\\n\"));\n\tPUTS (TXT(\"Input/Output:\\n\"));\n\tPUTS (TXT(\"  -i --input <file>        Input audio file [required]\\n\"));\n\tPUTS (TXT(\"  -d --input-lib <value>   Input decoder library [default: auto-detect]\\n\"));\n\tPUTS (TXT(\"  -o --output <file>       Output audio file [required]\\n\"));\n\tPUTS (TXT(\"  -t --output-fmt <value>  Output format [default: auto-detect]\\n\"));\n\tPUTS (TXT(\"  -u --output-bps <value>  Output bits per sample [default: like input]\\n\"));\n\tPUTS (TXT(\"\\n\"));\n\tPUTS (TXT(\"Algorithm Tweaks:\\n\"));\n\tPRINT(TXT(\"  -f --frame-len <value>   Frame length, in milliseconds [default: %u]\\n\"),               defaults.frameLenMsec());\n\tPRINT(TXT(\"  -g --gauss-size <value>  Gauss filter size, in frames [default: %u]\\n\"),                defaults.filterSize());\n\tPRINT(TXT(\"  -p --peak <value>        Target peak magnitude, 0.1-1 [default: %.2f]\\n\"),              defaults.peakValue());\n\tPRINT(TXT(\"  -m --max-gain <value>    Maximum gain factor [default: %.2f]\\n\"),                       defaults.maxAmplification());\n\tPRINT(TXT(\"  -r --target-rms <value>  Target RMS value [default: %.2f]\\n\"),                          defaults.targetRms());\n\tPRINT(TXT(\"  -n --no-coupling         Disable channel coupling [default: \") FMT_CHR TXT(\"]\\n\"),      BOOLIFY(defaults.channelsCoupled()));\n\tPRINT(TXT(\"  -c --correct-dc          Enable the DC bias correction [default: \") FMT_CHR TXT(\"]\\n\"), BOOLIFY(defaults.enableDCCorrection()));\n\tPRINT(TXT(\"  -b --alt-boundary        Use alternative boundary mode [default: \") FMT_CHR TXT(\"]\\n\"), BOOLIFY(defaults.altBoundaryMode()));\n\tPRINT(TXT(\"  -s --compress <value>    Compress the input data [default: %.2f]\\n\"),                   defaults.compressFactor());\n\tPUTS (TXT(\"\\n\"));\n\tPUTS (TXT(\"Diagnostics:\\n\"));\n\tPUTS (TXT(\"  -v --verbose             Output additional diagnostic info\\n\"));\n\tPUTS (TXT(\"  -l --log-file <file>     Create a log file\\n\"));\n\tPUTS (TXT(\"  -h --help                Print *this* help screen\\n\"));\n\tPUTS (TXT(\"\\n\"));\n\tPUTS (TXT(\"Raw Data Options:\\n\"));\n\tPUTS (TXT(\"  --input-bits <value>     Bits per sample, e.g. '16' or '32'\\n\"));\n\tPUTS (TXT(\"  --input-chan <value>     Number of channels, e.g. '2' for Stereo\\n\"));\n\tPUTS (TXT(\"  --input-rate <value>     Sample rate in Hertz, e.g. '44100'\\n\"));\n\tPUTS (TXT(\"\\n\"));\n}\n\nstatic void printLogo(void)\n{\n\tuint32_t versionMajor, versionMinor, versionPatch;\n\tMDynamicAudioNormalizer::getVersionInfo(versionMajor, versionMinor, versionPatch);\n\n\tconst char *buildDate, *buildTime, *buildCompiler, *buildArch; bool buildDebug;\n\tMDynamicAudioNormalizer::getBuildInfo(&buildDate, &buildTime, &buildCompiler, &buildArch, buildDebug);\n\n\tPRINT(TXT(\"---------------------------------------------------------------------------\\n\"));\n\n\tPRINT(TXT(\"Dynamic Audio Normalizer, Version %u.%02u-%u, \") FMT_CHR TXT(\"\\n\"), versionMajor, versionMinor, versionPatch, LINKAGE);\n\tPRINT(TXT(\"Copyright (c) 2014-\") FMT_chr TXT(\" LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\\n\"), &buildDate[7]);\n\tPRINT(TXT(\"Built on \") FMT_chr TXT(\" at \") FMT_chr TXT(\" with \") FMT_chr TXT(\" for \") OS_TYPE TXT(\"-\") FMT_chr TXT(\".\\n\\n\"), buildDate, buildTime, buildCompiler, buildArch);\n\n\tPRINT(TXT(\"This program is free software: you can redistribute it and/or modify\\n\"));\n\tPRINT(TXT(\"it under the terms of the GNU General Public License <http://www.gnu.org/>.\\n\"));\n\tPRINT(TXT(\"Note that this program is distributed with ABSOLUTELY NO WARRANTY.\\n\"));\n\n\tif(DYNAUDNORM_DEBUG)\n\t{\n\t\tPRINT(TXT(\"\\n!!! DEBUG BUILD !!! DEBUG BUILD !!! DEBUG BUILD !!! DEBUG BUILD !!!\\n\"));\n\t}\n\n\tPRINT(TXT(\"---------------------------------------------------------------------------\\n\\n\"));\n\n\tif((DYNAUDNORM_DEBUG) != buildDebug)\n\t{\n\t\tPRINT_ERR(TXT(\"Trying to use DEBUG library with RELEASE binary or vice versa!\\n\"));\n\t\texit(EXIT_FAILURE);\n\t}\n}\n\nint dynamicNormalizerMain(int argc, CHR* argv[])\n{\n\tprintLogo();\n\n\tParameters parameters;\n\tif(!parameters.parseArgs(argc, argv))\n\t{\n\t\tPRINT2_ERR(TXT(\"Invalid or incomplete command-line arguments have been detected.\\n\\nPlease type \\\"\") FMT_CHR TXT(\" --help\\\" for details!\\n\"), appName(argv[0]));\n\t\treturn EXIT_FAILURE;\n\t}\n\n\tif(parameters.showHelp())\n\t{\n\t\tprintHelpScreen(argc, argv);\n\t\treturn EXIT_SUCCESS;\n\t}\n\n\tMDynamicAudioNormalizer::setLogFunction(parameters.verboseMode() ? loggingCallback_verbose : loggingCallback_default);\n\n\tAudioIO *sourceFile = NULL, *outputFile = NULL;\n\tif(!openFiles(parameters, &sourceFile, &outputFile))\n\t{\n\t\tPRINT_ERR(TXT(\"Failed to open input and/or output file -> aborting!\\n\"));\n\t\treturn EXIT_FAILURE;\n\t}\n\n\tFILE *logFile = NULL;\n\tif(parameters.dbgLogFile())\n\t{\n\t\tif(!(logFile = FOPEN(parameters.dbgLogFile(), TXT(\"w\"))))\n\t\t{\n\t\t\tPRINT_WRN(TXT(\"Failed to open log file -> No log file will be created!\\n\"));\n\t\t}\n\t}\n\n\tconst clock_t clockStart = clock();\n\tconst int result = processFiles(parameters, sourceFile, outputFile, logFile);\n\tconst double elapsed = double(clock() - clockStart) / double(CLOCKS_PER_SEC);\n\n\tsourceFile->close();\n\toutputFile->close();\n\n\tMY_DELETE(sourceFile);\n\tMY_DELETE(outputFile);\n\n\tif(logFile)\n\t{\n\t\tfclose(logFile);\n\t\tlogFile = NULL;\n\t}\n\n\tPRINT(TXT(\"--------------\\n\\n\"));\n\tPRINT(FMT_CHR TXT(\"\\n\\nOperation took %.1f seconds.\\n\\n\"), ((result != EXIT_SUCCESS) ? TXT(\"Sorry, something went wrong :-(\") : TXT(\"Everything completed successfully :-)\")), elapsed);\n\n\treturn result;\n}\n\nint mainEx(int argc, CHR* argv[])\n{\n\tint exitCode = EXIT_SUCCESS;\n\n\ttry\n\t{\n\t\texitCode = dynamicNormalizerMain(argc, argv);\n\t}\n\tcatch(std::exception &e)\n\t{\n\t\tPRINT(TXT(\"\\n\\nGURU MEDITATION: Unhandeled C++ exception error: \") FMT_chr TXT(\"\\n\\n\"), e.what());\n\t\texitCode = EXIT_FAILURE;\n\t}\n\tcatch(...)\n\t{\n\t\tPRINT(TXT(\"\\n\\nGURU MEDITATION: Unhandeled unknown C++ exception error!\\n\\n\"));\n\t\texitCode = EXIT_FAILURE;\n\t}\n\n\treturn exitCode;\n}\n\nint MAIN(int argc, CHR* argv[])\n{\n\tint exitCode = EXIT_SUCCESS;\n\n\tif(DYNAUDNORM_DEBUG)\n\t{\n\t\tSYSTEM_INIT(true);\n\t\texitCode = dynamicNormalizerMain(argc, argv);\n\t}\n\telse\n\t{\n\t\tTRY_SEH\n\t\t{\n\t\t\tSYSTEM_INIT(false);\n\t\t\texitCode =  mainEx(argc, argv);\n\t\t}\n\t\tCATCH_SEH\n\t\t{\n\t\t\tPRINT(TXT(\"\\n\\nGURU MEDITATION: Unhandeled structured exception error!\\n\\n\"));\n\t\t\texitCode = EXIT_FAILURE;\n\t\t}\n\t}\n\n\treturn exitCode;\n}\n"
  },
  {
    "path": "DynamicAudioNormalizerCLI/src/Parameters.cpp",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Utility\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This program is free software; you can redistribute it and/or\n// modify it under the terms of the GNU General Public License\n// as published by the Free Software Foundation; either version 2\n// of the License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n//\n// http://www.gnu.org/licenses/gpl-2.0.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#include \"Parameters.h\"\n#include \"AudioIO.h\"\n\n#include <cerrno>\n\n///////////////////////////////////////////////////////////////////////////////\n// Helper functions\n///////////////////////////////////////////////////////////////////////////////\n\n#define IS_ARG_LONG(ARG_LONG)           (STRCASECMP(argv[pos], TXT(\"--\") TXT(ARG_LONG)) == 0)\n#define IS_ARG_SHRT(ARG_SHRT, ARG_LONG) ((STRCASECMP(argv[pos], TXT(\"-\") TXT(ARG_SHRT)) == 0) || (STRCASECMP(argv[pos], TXT(\"--\") TXT(ARG_LONG)) == 0))\n\n#define ENSURE_NEXT_ARG() do \\\n{ \\\n\tif(++pos >= argc) \\\n\t{ \\\n\t\tPRINT2_WRN(TXT(\"Missing argument for option \\\"\") FMT_CHR TXT(\"\\\".\\n\"), argv[pos-1]); \\\n\t\treturn false; \\\n\t} \\\n} \\\nwhile(0)\n\n#define ENSURE_NEXT_ARGS(N) do \\\n{ \\\n\tif(((pos++) + (N)) >= argc) \\\n\t{ \\\n\t\tPRINT2_WRN(TXT(\"Missing argument(s) for option \\\"\") FMT_CHR TXT(\"\\\".\\n\"), argv[pos-1]); \\\n\t\treturn false; \\\n\t} \\\n} \\\nwhile(0)\n\nstatic bool STR_TO_FLT(double &output, const CHR *str)\n{\n\tdouble temp;\n\tif(SSCANF(str, TXT(\"%lf\"), &temp) == 1)\n\t{\n\t\toutput = temp;\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nstatic bool STR_TO_UINT(uint32_t &output, const CHR *str)\n{\n\tuint32_t temp;\n\tif(SSCANF(str, TXT(\"%u\"), &temp) == 1)\n\t{\n\t\toutput = temp;\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n#define PARSE_VALUE_FLT(OUT) do \\\n{ \\\n\tif(!STR_TO_FLT((OUT), argv[pos])) \\\n\t{ \\\n\t\tPRINT2_WRN(TXT(\"Failed to parse floating point value \\\"\") FMT_CHR TXT(\"\\\"\\n\"), argv[pos]); \\\n\t\treturn false; \\\n\t} \\\n} \\\nwhile(0)\n\n#define PARSE_VALUE_UINT(OUT) do \\\n{ \\\n\tif(!STR_TO_UINT((OUT), argv[pos])) \\\n\t{ \\\n\t\tPRINT2_WRN(TXT(\"Failed to parse unsigned integral value \\\"\") FMT_CHR TXT(\"\\\"\\n\"), argv[pos]); \\\n\t\treturn false; \\\n\t} \\\n} \\\nwhile(0)\n\nstatic bool CHECK_ENUM(const CHR *const str, const CHR *const *const values)\n{\n\tfor (size_t i = 0; values[i]; ++i)\n\t{\n\t\tif (STRCASECMP(str, values[i]) == 0)\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\nstatic const CHR *JOIN_STR(CHR *const buffer, uint32_t buffSize, const CHR *const *const values, const CHR *const separator)\n{\n\tif (buffer && (buffSize > 0))\n\t{\n\t\tbuffer[0] = TXT('\\0');\n\t\tfor (size_t i = 0; values[i]; ++i)\n\t\t{\n\t\t\tif (i > 0)\n\t\t\t{\n\t\t\t\tSTRNCAT(buffer, separator, buffSize);\n\t\t\t}\n\t\t\tSTRNCAT(buffer, values[i], buffSize);\n\t\t}\n\t}\n\treturn buffer;\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Parameters Class\n///////////////////////////////////////////////////////////////////////////////\n\nParameters::Parameters(void)\n{\n\tsetDefaults();\n}\n\nParameters::~Parameters(void)\n{\n}\n\nvoid Parameters::setDefaults(void)\n{\n\tm_sourceFile    = NULL;\n\tm_sourceLibrary = NULL;\n\tm_outputFile    = NULL;\n\tm_outputFormat  = NULL;\n\tm_dbgLogFile    = NULL;\n\n\tm_frameLenMsec = 500;\n\tm_filterSize   = 31;\n\t\n\tm_inputChannels   = 0U;\n\tm_inputSampleRate = 0U;\n\tm_inputBitDepth   = 0U;\n\tm_outputBitDepth  = 0U;\n\n\tm_channelsCoupled    = true;\n\tm_enableDCCorrection = false;\n\tm_altBoundaryMode    = false;\n\tm_verboseMode        = false;\n\tm_showHelp           = false;\n\t\n\tm_peakValue        =  0.95;\n\tm_maxAmplification = 10.00;\n\tm_targetRms        =  0.00;\n\tm_compressFactor   =  0.00;\n}\n\nbool Parameters::parseArgs(const int argc, CHR* argv[])\n{\n\tint pos = 0;\n\n\twhile(++pos < argc)\n\t{\n\t\t/*help screen*/\n\t\tif(IS_ARG_SHRT(\"h\", \"help\"))\n\t\t{\n\t\t\tm_showHelp = true;\n\t\t\tbreak;\n\t\t}\n\n\t\t/*input and output*/\n\t\tif(IS_ARG_SHRT(\"i\", \"input\"))\n\t\t{\n\t\t\tENSURE_NEXT_ARG();\n\t\t\tm_sourceFile = argv[pos];\n\t\t\tcontinue;\n\t\t}\n\t\tif (IS_ARG_SHRT(\"d\", \"input-lib\"))\n\t\t{\n\t\t\tENSURE_NEXT_ARG();\n\t\t\tm_sourceLibrary = argv[pos];\n\t\t\tcontinue;\n\t\t}\n\t\tif(IS_ARG_SHRT(\"o\", \"output\"))\n\t\t{\n\t\t\tENSURE_NEXT_ARG();\n\t\t\tm_outputFile = argv[pos];\n\t\t\tcontinue;\n\t\t}\n\t\tif (IS_ARG_SHRT(\"t\", \"output-fmt\"))\n\t\t{\n\t\t\tENSURE_NEXT_ARG();\n\t\t\tm_outputFormat = argv[pos];\n\t\t\tcontinue;\n\t\t}\n\t\tif (IS_ARG_SHRT(\"u\", \"output-bps\"))\n\t\t{\n\t\t\tENSURE_NEXT_ARG();\n\t\t\tPARSE_VALUE_UINT(m_outputBitDepth);\n\t\t\tcontinue;\n\t\t}\n\n\t\t/*algorithm twekas*/\n\t\tif(IS_ARG_SHRT(\"f\", \"frame-len\"))\n\t\t{\n\t\t\tENSURE_NEXT_ARG();\n\t\t\tPARSE_VALUE_UINT(m_frameLenMsec);\n\t\t\tcontinue;\n\t\t}\n\t\tif(IS_ARG_SHRT(\"g\", \"gauss-size\"))\n\t\t{\n\t\t\tENSURE_NEXT_ARG();\n\t\t\tPARSE_VALUE_UINT(m_filterSize);\n\t\t\tcontinue;\n\t\t}\n\t\tif(IS_ARG_SHRT(\"p\", \"peak\"))\n\t\t{\n\t\t\tENSURE_NEXT_ARG();\n\t\t\tPARSE_VALUE_FLT(m_peakValue);\n\t\t\tcontinue;\n\t\t}\n\t\tif(IS_ARG_SHRT(\"m\", \"max-gain\"))\n\t\t{\n\t\t\tENSURE_NEXT_ARG();\n\t\t\tPARSE_VALUE_FLT(m_maxAmplification);\n\t\t\tcontinue;\n\t\t}\n\t\tif(IS_ARG_SHRT(\"r\", \"target-rms\"))\n\t\t{\n\t\t\tENSURE_NEXT_ARG();\n\t\t\tPARSE_VALUE_FLT(m_targetRms);\n\t\t\tcontinue;\n\t\t}\n\t\tif(IS_ARG_SHRT(\"s\", \"compress\"))\n\t\t{\n\t\t\tENSURE_NEXT_ARG();\n\t\t\tPARSE_VALUE_FLT(m_compressFactor);\n\t\t\tcontinue;\n\t\t}\n\t\tif(IS_ARG_SHRT(\"n\", \"no-coupling\"))\n\t\t{\n\t\t\tm_channelsCoupled = false;\n\t\t\tcontinue;\n\t\t}\n\t\tif(IS_ARG_SHRT(\"c\", \"correct-dc\"))\n\t\t{\n\t\t\tm_enableDCCorrection = true;\n\t\t\tcontinue;\n\t\t}\n\t\tif(IS_ARG_SHRT(\"b\", \"alt-boundary\"))\n\t\t{\n\t\t\tm_altBoundaryMode = true;\n\t\t\tcontinue;\n\t\t}\n\n\t\t/*diagnostics*/\n\t\tif(IS_ARG_SHRT(\"l\", \"log-file\"))\n\t\t{\n\t\t\tENSURE_NEXT_ARG();\n\t\t\tm_dbgLogFile = argv[pos];\n\t\t\tcontinue;\n\t\t}\n\t\tif(IS_ARG_SHRT(\"v\", \"verbose\"))\n\t\t{\n\t\t\tm_verboseMode = true;\n\t\t\tcontinue;\n\t\t}\n\n\t\t/*raw input options*/\n\t\tif(IS_ARG_LONG(\"input-chan\"))\n\t\t{\n\t\t\tENSURE_NEXT_ARG();\n\t\t\tPARSE_VALUE_UINT(m_inputChannels);\n\t\t\tcontinue;\n\t\t}\n\t\tif(IS_ARG_LONG(\"input-rate\"))\n\t\t{\n\t\t\tENSURE_NEXT_ARG();\n\t\t\tPARSE_VALUE_UINT(m_inputSampleRate);\n\t\t\tcontinue;\n\t\t}\n\t\tif(IS_ARG_LONG(\"input-bits\"))\n\t\t{\n\t\t\tENSURE_NEXT_ARG();\n\t\t\tPARSE_VALUE_UINT(m_inputBitDepth);\n\t\t\tcontinue;\n\t\t}\n\n\t\tPRINT2_WRN(TXT(\"Unknown command-line argument \\\"\") FMT_CHR TXT(\"\\\"\\n\"), argv[pos]);\n\t\treturn false;\n\t}\n\n\tif((!m_showHelp) && (pos < argc))\n\t{\n\t\tPRINT2_WRN(TXT(\"Excess command-line argument \\\"\") FMT_CHR TXT(\"\\\"\\n\"), argv[pos]);\n\t\treturn false;\n\t}\n\n\treturn m_showHelp || validateParameters();\n}\n\nbool Parameters::validateParameters(void)\n{\n\tif(!m_sourceFile)\n\t{\n\t\tPRINT_WRN(TXT(\"Input file not specified!\\n\"));\n\t\treturn false;\n\t}\n\tif(!m_outputFile)\n\t{\n\t\tPRINT_WRN(TXT(\"Output file not specified!\\n\"));\n\t\treturn false;\n\t}\n\n\t/*validate input library*/\n\tif (m_sourceLibrary)\n\t{\n\t\tconst CHR *supportedLibraries[8];\n\t\tif (!CHECK_ENUM(m_sourceLibrary, AudioIO::getSupportedLibraries(supportedLibraries, 8)))\n\t\t{\n\t\t\tCHR allLibraries[128];\n\t\t\tPRINT2_WRN(TXT(\"Unknown input library \\\"\") FMT_CHR TXT(\"\\\" specified!\\nSupported libraries include: \") FMT_CHR TXT(\"\\n\"), m_sourceLibrary, JOIN_STR(allLibraries, 128, supportedLibraries, TXT(\", \")));\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/*validate output format*/\n\tif(m_outputFormat)\n\t{\n\t\tconst CHR *supportedFormats[32];\n\t\tif (!CHECK_ENUM(m_outputFormat, AudioIO::getSupportedFormats(supportedFormats, 32)))\n\t\t{\n\t\t\tCHR allFormats[256];\n\t\t\tPRINT2_WRN(TXT(\"Unknown output format \\\"\") FMT_CHR TXT(\"\\\" specified!\\nSupported formats include: \") FMT_CHR TXT(\"\\n\"), m_outputFormat, JOIN_STR(allFormats, 256, supportedFormats, TXT(\", \")));\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/*validate output bit-depth*/\n\tif (m_outputBitDepth)\n\t{\n\t\tif((m_outputBitDepth != 8U) && (m_outputBitDepth != 16U) && (m_outputBitDepth != 24U) && (m_outputBitDepth != 32U))\n\t\t{\n\t\t\tPRINT2_WRN(TXT(\"Invalid output bit-depth %u specified!\\nSupported bit-depth include: 8, 16, 24 and 32 bits/sample\\n\"), m_outputBitDepth);\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/*check input file*/\n\tif(STRCASECMP(m_sourceFile, TXT(\"-\")) != 0)\n\t{\n\t\tif(ACCESS(m_sourceFile, R_OK) != 0)\n\t\t{\n\t\t\tif(errno != ENOENT)\n\t\t\t{\n\t\t\t\tPRINT_WRN(TXT(\"Selected input file can not be read!\\n\"));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tPRINT_WRN(TXT(\"Selected input file does not exist!\\n\"));\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/*check output file*/\n\tif(STRCASECMP(m_outputFile, TXT(\"-\")) != 0)\n\t{\n\t\tif(ACCESS(m_outputFile, W_OK) != 0)\n\t\t{\n\t\t\tif(errno != ENOENT)\n\t\t\t{\n\t\t\t\tPRINT_WRN(TXT(\"Selected output file is read-only!\\n\"));\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\n\t/*check input properties for raw data*/\n\tif((STRCASECMP(m_sourceFile, TXT(\"-\")) == 0) && (!FD_ISREG(FILENO(stdin))))\n\t{\n\t\tif((m_inputChannels == 0) || (m_inputSampleRate == 0) || (m_inputBitDepth == 0))\n\t\t{\n\t\t\tPRINT2_WRN(TXT(\"Channel-count, sample-rate and bit-depth *must* be specified for pipe'd input!\\n\"), m_filterSize);\n\t\t\treturn false;\n\t\t}\n\t}\n\telse\n\t{\n\t\tif((m_inputChannels != 0) || (m_inputSampleRate != 0) || (m_inputBitDepth != 0))\n\t\t{\n\t\t\tPRINT2_WRN(TXT(\"Channel-count, sample-rate and bit-depth will be *ignored* for file source!\\n\"), m_filterSize);\n\t\t}\n\t}\n\n\t/*parameter range checking*/\n\tif((m_filterSize < 3) || (m_filterSize > 301))\n\t{\n\t\tPRINT2_WRN(TXT(\"Filter size %u is out of range. Must be in the 3 to 301 range!\\n\"), m_filterSize);\n\t\treturn false;\n\t}\n\tif((m_filterSize % 2) != 1)\n\t{\n\t\tPRINT2_WRN(TXT(\"Filter size %u is invalid. Must be an odd value! (i.e. 'filter_size mod 2 == 1')\\n\"), m_filterSize);\n\t\treturn false;\n\t}\n\tif((m_peakValue < 0.01) || (m_peakValue > 1.0))\n\t{\n\t\tPRINT2_WRN(TXT(\"Peak value value %.2f is out of range. Must be in the 0.01 to 1.00 range!\\n\"), m_peakValue);\n\t\treturn false;\n\t}\n\tif((m_targetRms < 0.0) || (m_targetRms > 1.0))\n\t{\n\t\tPRINT2_WRN(TXT(\"Target RMS value %.2f is out of range. Must be in the 0.00 to 1.00 range!\\n\"), m_targetRms);\n\t\treturn false;\n\t}\n\tif((m_compressFactor && (m_compressFactor < 1.0)) || (m_compressFactor > 30.0))\n\t{\n\t\tPRINT2_WRN(TXT(\"Compression threshold value %.2f is out of range. Must be in the 1.00 to 30.00 range!\\n\"), m_compressFactor);\n\t\treturn false;\n\t}\n\tif((m_maxAmplification < 1.0) || (m_maxAmplification > 100.0))\n\t{\n\t\tPRINT2_WRN(TXT(\"Maximum amplification %.2f is out of range. Must be in the 1.00 to 100.00 range!\\n\"), m_maxAmplification);\n\t\treturn false;\n\t}\n\tif((m_frameLenMsec < 10) || (m_frameLenMsec > 8000))\n\t{\n\t\tPRINT2_WRN(TXT(\"Frame length %u is out of range. Must be in the 10 to 8000 range!\\n\"), m_frameLenMsec);\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n"
  },
  {
    "path": "DynamicAudioNormalizerCLI/src/Parameters.h",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Utility\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This program is free software; you can redistribute it and/or\n// modify it under the terms of the GNU General Public License\n// as published by the Free Software Foundation; either version 2\n// of the License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n//\n// http://www.gnu.org/licenses/gpl-2.0.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#pragma once\n\n#include \"Common.h\"\n#include \"Platform.h\"\n\nclass Parameters\n{\npublic:\n\tParameters(void);\n\t~Parameters(void);\n\t\n\tbool parseArgs(const int argc, CHR* argv[]);\n\n\tinline const CHR* sourceFile(void)    const { return m_sourceFile;    }\n\tinline const CHR* sourceLibrary(void) const { return m_sourceLibrary; }\n\tinline const CHR* outputFile(void)    const { return m_outputFile;    }\n\tinline const CHR* outputFormat(void)  const { return m_outputFormat;  }\n\tinline const CHR* dbgLogFile(void)    const { return m_dbgLogFile;    }\n\t\n\tinline const uint32_t &frameLenMsec(void)       const { return m_frameLenMsec;       }\n\tinline const uint32_t &filterSize(void)         const { return m_filterSize;         }\n\tinline const uint32_t &inputChannels(void)      const { return m_inputChannels;      }\n\tinline const uint32_t &inputSampleRate(void)    const { return m_inputSampleRate;    }\n\tinline const uint32_t &inputBitDepth(void)      const { return m_inputBitDepth;      }\n\tinline const uint32_t &outputBitDepth(void)     const { return m_outputBitDepth;     }\n\tinline const double   &peakValue(void)          const { return m_peakValue;          }\n\tinline const double   &maxAmplification(void)   const { return m_maxAmplification;   }\n\tinline const double   &targetRms(void)          const { return m_targetRms;          }\n\tinline const double   &compressFactor(void)     const { return m_compressFactor;     }\n\tinline const bool     &channelsCoupled(void)    const { return m_channelsCoupled;    }\n\tinline const bool     &enableDCCorrection(void) const { return m_enableDCCorrection; }\n\tinline const bool     &altBoundaryMode(void)    const { return m_altBoundaryMode;    }\n\tinline const bool     &showHelp(void)           const { return m_showHelp;           }\n\tinline const bool     &verboseMode(void)        const { return m_verboseMode;        }\n\nprotected:\n\tvoid setDefaults(void);\n\tbool validateParameters(void);\n\nprivate:\n\tconst CHR* m_sourceFile;\n\tconst CHR* m_sourceLibrary;\n\tconst CHR* m_outputFile;\n\tconst CHR* m_outputFormat;\n\tconst CHR* m_dbgLogFile;\n\n\tuint32_t m_frameLenMsec;\n\tuint32_t m_filterSize;\n\tuint32_t m_inputChannels;\n\tuint32_t m_inputSampleRate;\n\tuint32_t m_inputBitDepth;\n\tuint32_t m_outputBitDepth;\n\n\tbool m_channelsCoupled;\n\tbool m_enableDCCorrection;\n\tbool m_altBoundaryMode;\n\tbool m_verboseMode;\n\tbool m_showHelp;\n\t\n\tdouble m_peakValue;\n\tdouble m_maxAmplification;\n\tdouble m_targetRms;\n\tdouble m_compressFactor;\n};\n"
  },
  {
    "path": "DynamicAudioNormalizerCLI/src/Platform.h",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Utility\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This program is free software; you can redistribute it and/or\n// modify it under the terms of the GNU General Public License\n// as published by the Free Software Foundation; either version 2\n// of the License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n//\n// http://www.gnu.org/licenses/gpl-2.0.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#pragma once\n\n#ifdef _DYNAUDNORM_PLATFORM_SUPPORT\n#undef _DYNAUDNORM_PLATFORM_SUPPORT\n#endif\n\n#ifndef __STDC_LIMIT_MACROS\n#define __STDC_LIMIT_MACROS\n#endif\n\n#include <cstdlib>\n#include <stdint.h>\n#include <cstdio>\n#include <cstring>\n#include <cstdarg>\n\n#include <sys/types.h>\n#include <sys/stat.h>\n\n//============================================================================\n// WINDOWS | MSVC\n//============================================================================\n\n#if defined(_WIN32) && defined(_MSC_VER) /*Windows MSVC only*/\n\n#ifndef _DYNAUDNORM_PLATFORM_SUPPORT\n#define _DYNAUDNORM_PLATFORM_SUPPORT 1\n#else\n#error Whoops, more than one platform has been detected!\n#endif\n\n#include <io.h>\n#include <fcntl.h>\n\n#define _TXT(X) L##X\n#define TXT(X) _TXT(X)\n#define OS_TYPE TXT(\"Win\")\n#define FMT_CHR TXT(\"%s\")\n#define FMT_chr TXT(\"%S\")\n#define MAIN wmain\n#define TRY_SEH __try\n#define CATCH_SEH __except(1)\n\n#define F_OK 0\n#define X_OK 1\n#define W_OK 2\n#define R_OK 4\n\ntypedef wchar_t CHR;\ntypedef struct _stat64 STAT64_T;\n\ninline static int PRINT(const CHR *const format, ...)\n{\n\tva_list ap;\n\tva_start(ap, format);\n\tconst int result = vfwprintf_s(stderr, format, ap);\n\tva_end(ap);\n\treturn result;\n}\n\ninline static int PUTS(const CHR *const format)\n{\n\treturn fputws(format, stderr);\n}\n\ninline static void FLUSH(void)\n{\n\tfflush(stderr);\n}\n\ninline static FILE *FOPEN(const CHR *const fileName, const CHR *const mode)\n{\n\tFILE *temp;\n\tif(_wfopen_s(&temp, fileName, mode) == 0)\n\t{\n\t\treturn temp;\n\t}\n\treturn NULL;\n}\n\ninline static int OPEN(const CHR *const fileName, const int flags)\n{\n\tint temp;\n\tif (_wsopen_s(&temp, fileName, _O_BINARY | flags, _SH_DENYWR, 0) == 0)\n\t{\n\t\treturn temp;\n\t}\n\treturn -1;\n}\n\ninline static int CLOSE(const int fd)\n{\n\treturn _close(fd);\n}\n\ninline static int FILENO(FILE *const file)\n{\n\treturn _fileno(file);\n}\n\ninline static int FSTAT64(const int fd, STAT64_T *stat)\n{\n\treturn _fstat64(fd, stat);\n}\n\ninline static int FSEEK64(FILE *const file, int64_t offset, const int origin)\n{\n\treturn _fseeki64(file, offset, origin);\n}\n\ninline static int64_t FTELL64(FILE *const file)\n{\n\treturn _ftelli64(file);\n}\n\ninline static int ACCESS(const CHR *const fileName, const int mode)\n{\n\treturn _waccess(fileName, mode);\n}\n\ninline static int STAT64(const CHR *const fileName, STAT64_T *stat)\n{\n\treturn _wstat64(fileName, stat);\n}\n\ninline static int STRCASECMP(const CHR *const s1, const CHR *const s2)\n{\n\treturn _wcsicmp(s1, s2);\n}\n\ninline static const CHR *STRCHR(const CHR *const str, const CHR c)\n{\n\treturn wcschr(str, c);\n}\n\ninline static const CHR *STRRCHR(const CHR *const str, const CHR c)\n{\n\treturn wcsrchr(str, c);\n}\n\ninline static int SNPRINTF(CHR *const buffer, size_t buffSize, const CHR *const format, ...)\n{\n\tva_list ap;\n\tva_start(ap, format);\n\tconst int result = _vsnwprintf_s(buffer, buffSize, _TRUNCATE, format, ap);\n\tva_end(ap);\n\treturn result;\n}\n\ninline static int SSCANF(const CHR *const str, const CHR *const format, ...)\n{\n\tva_list ap;\n\tva_start(ap, format);\n\tconst int result = vswscanf(str, format, ap);\n\tva_end(ap);\n\treturn result;\n}\n\ninline static const CHR *STRNCAT(CHR *const buff, const CHR *const str, const uint32_t len)\n{\n\twcsncat_s(buff, len, str, _TRUNCATE);\n\treturn buff;\n}\n\n#endif //_WIN32\n\n//============================================================================\n// WINDOWS | MINGW\n//============================================================================\n\n#if defined(_WIN32) && defined(__MINGW32__) /*Windows MinGW only*/\n\n#ifndef _DYNAUDNORM_PLATFORM_SUPPORT\n#define _DYNAUDNORM_PLATFORM_SUPPORT 1\n#else\n#error Whoops, more than one platform has been detected!\n#endif\n\n#include <io.h>\n\n#define _TXT(X) L##X\n#define TXT(X) _TXT(X)\n#define OS_TYPE TXT(\"Win\")\n#define FMT_CHR TXT(\"%ls\")\n#define FMT_chr TXT(\"%s\")\n#define MAIN wmain\n#define TRY_SEH if(1)\n#define CATCH_SEH else\n\n#define F_OK 0\n#define X_OK 1\n#define W_OK 2\n#define R_OK 4\n\ntypedef wchar_t CHR;\ntypedef struct _stati64 STAT64_T;\n\ninline static int PRINT(const CHR *const format, ...)\n{\n\tva_list ap;\n\tva_start(ap, format);\n\tconst int result = vfwprintf(stderr, format, ap);\n\tva_end(ap);\n\treturn result;\n}\n\ninline static void FLUSH(void)\n{\n\tfflush(stderr);\n}\n\ninline static FILE *FOPEN(const CHR *const fileName, const CHR *const mode)\n{\n\treturn _wfopen(fileName, mode);\n}\n\ninline static int FILENO(FILE *const file)\n{\n\treturn _fileno(file);\n}\n\ninline static int FSTAT64(const int fd, STAT64_T *stat)\n{\n\treturn _fstati64(fd, stat);\n}\n\ninline static int FSEEK64(FILE *const file, int64_t offset, const int origin)\n{\n\treturn fseeko64(file, offset, origin); //__mingw_fseeko64(file, offset, origin)\n}\n\ninline static int64_t FTELL64(FILE *const file)\n{\n\treturn ftello64(file);\n}\n\ninline static int ACCESS(const CHR *const fileName, const int mode)\n{\n\treturn _waccess(fileName, mode);\n}\n\ninline static int STAT64(const CHR *const fileName, STAT64_T *stat)\n{\n\treturn _wstati64(fileName, stat);\n}\n\ninline static int STRCASECMP(const CHR *const s1, const CHR *const s2)\n{\n\treturn _wcsicmp(s1, s2);\n}\n\ninline static const CHR *STRCHR(const CHR *const str, const CHR c)\n{\n\treturn wcschr(str, c);\n}\n\ninline static const CHR *STRRCHR(const CHR *const str, const CHR c)\n{\n\treturn wcsrchr(str, c);\n}\n\ninline static int SNPRINTF(CHR *const buffer, size_t buffSize, const CHR *const format, ...)\n{\n\tva_list ap;\n\tva_start(ap, format);\n\tconst int result = _vsnwprintf(buffer, buffSize, format, ap);\n\tbuffer[buffSize-1] = 0x00;\n\tva_end(ap);\n\treturn result;\n}\n\ninline static int SSCANF(const CHR *const str, const CHR *const format, ...)\n{\n\tva_list ap;\n\tva_start(ap, format);\n\tconst int result = vswscanf(str, format, ap);\n\tva_end(ap);\n\treturn result;\n}\n\ninline static const CHR *STRNCAT(CHR *const buff, const CHR *const str, const uint32_t len)\n{\n\tconst size_t offset = wcslen(buffer);\n\tif (len >= 1)\n\t{\n\t\treturn wcsncat(buff, str, len - offset - 1);\n\t}\n\treturn buff;\n}\n\n#endif //_WIN32\n\n//============================================================================\n// LINUX\n//============================================================================\n\n#ifdef __linux /*Linux only*/\n\n#ifndef _DYNAUDNORM_PLATFORM_SUPPORT\n#define _DYNAUDNORM_PLATFORM_SUPPORT 1\n#else\n#error Whoops, more than one platform has been detected!\n#endif\n\n#include <unistd.h>\n\n#define _TXT(X) X\n#define TXT(X) _TXT(X)\n#define OS_TYPE TXT(\"Linux\")\n#define FMT_CHR TXT(\"%s\")\n#define FMT_chr TXT(\"%s\")\n#define MAIN main\n#define TRY_SEH if(1)\n#define CATCH_SEH else\n\ntypedef char CHR;\ntypedef struct stat64 STAT64_T;\n\ninline static int PRINT(const CHR *const format, ...)\n{\n\tva_list ap;\n\tva_start(ap, format);\n\tconst int result = vfprintf(stderr, format, ap);\n\tva_end(ap);\n\treturn result;\n}\n\ninline static void FLUSH(void)\n{\n\tfflush(stderr);\n}\n\ninline static FILE *FOPEN(const CHR *const fileName, const CHR *const mode)\n{\n\treturn fopen(fileName, mode);\n}\n\ninline static int FILENO(FILE *const file)\n{\n\treturn fileno(file);\n}\n\ninline static int FSTAT64(const int fd, STAT64_T *stat)\n{\n\treturn fstat64(fd, stat);\n}\n\ninline static int FSEEK64(FILE *const file, int64_t offset, const int origin)\n{\n\treturn fseeko64(file, offset, origin);\n}\n\ninline static int64_t FTELL64(FILE *const file)\n{\n\treturn ftello64(file);\n}\n\ninline static int ACCESS(const CHR *const fileName, const int mode)\n{\n\treturn access(fileName, mode);\n}\n\ninline static int STAT64(const CHR *const fileName, STAT64_T *stat)\n{\n\treturn stat64(fileName, stat);\n}\n\ninline static int STRCASECMP(const CHR *const s1, const CHR *const s2)\n{\n\treturn strcasecmp(s1, s2);\n}\n\ninline static const CHR *STRCHR(const CHR *const str, const CHR c)\n{\n\treturn strchr(str, c);\n}\n\ninline static const CHR *STRRCHR(const CHR *const str, const CHR c)\n{\n\treturn strrchr(str, c);\n}\n\ninline static int SNPRINTF(CHR *const buffer, size_t buffSize, const CHR *const format, ...)\n{\n\tva_list ap;\n\tva_start(ap, format);\n\tconst int result = vsnprintf(buffer, buffSize, format, ap);\n\tva_end(ap);\n\treturn result;\n}\n\ninline static int SSCANF(const CHR *const str, const CHR *const format, ...)\n{\n\tva_list ap;\n\tva_start(ap, format);\n\tconst int result = vsscanf(str, format, ap);\n\tva_end(ap);\n\treturn result;\n}\n\ninline static const CHR *STRNCAT(CHR *const buff, const CHR *const str, const uint32_t len)\n{\n\tconst size_t offset = strlen(buff);\n\tif (len >= 1)\n\t{\n\t\treturn strncat(buff, str, len - offset - 1);\n\t}\n\treturn buff;\n}\n\n#endif //__linux\n\n//============================================================================\n// OS X\n//============================================================================\n\n#ifdef __APPLE__ // OS X\n\n#ifndef _DYNAUDNORM_PLATFORM_SUPPORT\n#define _DYNAUDNORM_PLATFORM_SUPPORT 1\n#else\n#error Whoops, more than one platform has been detected!\n#endif\n\n#include <unistd.h>\n\n#define _TXT(X) X\n#define TXT(X) _TXT(X)\n#define OS_TYPE TXT(\"OS X\")\n#define FMT_CHR TXT(\"%s\")\n#define FMT_chr TXT(\"%s\")\n#define MAIN main\n#define TRY_SEH if(1)\n#define CATCH_SEH else\n\ntypedef char CHR;\ntypedef struct stat STAT64_T;\n\ninline static int PRINT(const CHR *const format, ...)\n{\n\tva_list ap;\n\tva_start(ap, format);\n\tconst int result = vfprintf(stderr, format, ap);\n\tva_end(ap);\n\treturn result;\n}\n\ninline static void FLUSH(void)\n{\n\tfflush(stderr);\n}\n\ninline static FILE *FOPEN(const CHR *const fileName, const CHR *const mode)\n{\n\treturn fopen(fileName, mode);\n}\n\ninline static int FILENO(FILE *const file)\n{\n\treturn fileno(file);\n}\n\ninline static int FSTAT64(const int fd, STAT64_T *_stat)\n{\n\treturn fstat(fd, _stat);\n}\n\ninline static int FSEEK64(FILE *const file, int64_t offset, const int origin)\n{\n\treturn fseeko(file, offset, origin);\n}\n\ninline static int64_t FTELL64(FILE *const file)\n{\n\treturn ftello(file);\n}\n\ninline static int ACCESS(const CHR *const fileName, const int mode)\n{\n\treturn access(fileName, mode);\n}\n\ninline static int STAT64(const CHR *const fileName, STAT64_T *stat)\n{\n\treturn stat64(fileName, stat);\n}\n\ninline static int STRCASECMP(const CHR *const s1, const CHR *const s2)\n{\n\treturn strcasecmp(s1, s2);\n}\n\ninline static const CHR *STRCHR(const CHR *const str, const CHR c)\n{\n\treturn strchr(str, c);\n}\n\ninline static const CHR *STRRCHR(const CHR *const str, const CHR c)\n{\n\treturn strrchr(str, c);\n}\n\ninline static int SNPRINTF(CHR *const buffer, size_t buffSize, const CHR *const format, ...)\n{\n\tva_list ap;\n\tva_start(ap, format);\n\tconst int result = vsnprintf(buffer, buffSize, format, ap);\n\tva_end(ap);\n\treturn result;\n}\n\ninline static int SSCANF(const CHR *const str, const CHR *const format, ...)\n{\n\tva_list ap;\n\tva_start(ap, format);\n\tconst int result = vsscanf(str, format, ap);\n\tva_end(ap);\n\treturn result;\n}\n\ninline static const CHR *STRNCAT(CHR *const buff, const CHR *const str, const uint32_t len)\n{\n\tconst size_t offset = strlen(buff);\n\tif (len >= 1)\n\t{\n\t\treturn strncat(buff, str, len - offset - 1);\n\t}\n\treturn buff;\n}\n\n#endif // __APPLE__\n\n//============================================================================\n// COMMON\n//============================================================================\n\nvoid SYSTEM_INIT(const bool &debugMode);\n\n#define PRINT_NFO(X) do { PUTS(TXT(\"INFO: \")    X TXT(\"\\n\")); } while(0)\n#define PRINT_WRN(X) do { PUTS(TXT(\"WARNING: \") X TXT(\"\\n\")); } while(0)\n#define PRINT_ERR(X) do { PUTS(TXT(\"ERROR: \")   X TXT(\"\\n\")); } while(0)\n\n#define PRINT2_NFO(X, ...) do { PRINT(TXT(\"INFO: \")    X TXT(\"\\n\"), __VA_ARGS__); } while(0)\n#define PRINT2_WRN(X, ...) do { PRINT(TXT(\"WARNING: \") X TXT(\"\\n\"), __VA_ARGS__); } while(0)\n#define PRINT2_ERR(X, ...) do { PRINT(TXT(\"ERROR: \")   X TXT(\"\\n\"), __VA_ARGS__); } while(0)\n\ninline static bool FD_ISREG(const int fd)\n{\n\tSTAT64_T _stat;\n\tif (FSTAT64(fd, &_stat) == 0)\n\t{\n\t\treturn ((_stat.st_mode & S_IFMT) == S_IFREG);\n\t}\n\treturn false;\n}\n\ninline static bool PATH_ISREG(const CHR *const fileName)\n{\n\tSTAT64_T _stat;\n\tif (STAT64(fileName, &_stat) == 0)\n\t{\n\t\treturn ((_stat.st_mode & S_IFMT) == S_IFREG);\n\t}\n\treturn false;\n}\n\n//============================================================================\n// VALIDATION\n//============================================================================\n\n/*make sure one platform has been initialized!*/\n#if !(defined(_DYNAUDNORM_PLATFORM_SUPPORT) && _DYNAUDNORM_PLATFORM_SUPPORT)\n#error This platform is *not* currently supported!\n#endif\n"
  },
  {
    "path": "DynamicAudioNormalizerCLI/src/Platform_Linux.cpp",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Utility\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This program is free software; you can redistribute it and/or\n// modify it under the terms of the GNU General Public License\n// as published by the Free Software Foundation; either version 2\n// of the License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n//\n// http://www.gnu.org/licenses/gpl-2.0.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#include \"Platform.h\"\n\n#ifdef __linux\n\n#pragma GCC diagnostic ignored \"-Wunused-result\"\n\n#include <csignal>\n#include <unistd.h>\n\nstatic void my_crash_handler(const char *const message)\n{\n\ttry\n\t{\n\t\twrite(STDERR_FILENO, message, strlen(message));\n\t\tfsync(STDERR_FILENO);\n\t}\n\tcatch(...)\n\t{\n\t\t/*ignore any exception*/\n\t}\n\tfor(;;)\n\t{\n\t\t_exit(666);\n\t}\n}\n\nstatic void my_signal_handler(int signal_num)\n{\n\tif(signal_num != SIGINT)\n\t{\n\t\tmy_crash_handler(\"\\n\\nGURU MEDITATION: Signal handler has been invoked, application will exit!\\n\\n\");\n\t}\n\telse\n\t{\n\t\tmy_crash_handler(\"\\n\\nGURU MEDITATION: Operation has been interrupted, application will exit!\\n\\n\");\n\t}\n}\n\nvoid SYSTEM_INIT(const bool &debugMode)\n{\n\tstatic const int signal_num[6] = { SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV, SIGTERM };\n\n\tif(!debugMode)\n\t{\n\t\tfor(size_t i = 0; i < 6; i++)\n\t\t{\n\t\t\tstruct sigaction sa;\n\t\t\tsa.sa_handler = my_signal_handler;\n\t\t\tsigemptyset(&sa.sa_mask);\n\t\t\tsa.sa_flags = SA_RESTART;\n\t\t\tsigaction(signal_num[i], &sa, NULL);\n\t\t}\n\t}\n}\n\n#endif //__linux\n\n"
  },
  {
    "path": "DynamicAudioNormalizerCLI/src/Platform_OSX.cpp",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Utility\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This program is free software; you can redistribute it and/or\n// modify it under the terms of the GNU General Public License\n// as published by the Free Software Foundation; either version 2\n// of the License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n//\n// http://www.gnu.org/licenses/gpl-2.0.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#include \"Platform.h\"\n\n#ifdef __APPLE__\n\n#pragma GCC diagnostic ignored \"-Wunused-result\"\n\n#include <csignal>\n#include <unistd.h>\n\nstatic void my_crash_handler(const char *const message)\n{\n  try\n  {\n    write(STDERR_FILENO, message, strlen(message));\n    fsync(STDERR_FILENO);\n  }\n  catch(...)\n  {\n    /*ignore any exception*/\n  }\n  for(;;)\n  {\n    _exit(666);\n  }\n}\n\nstatic void my_signal_handler(int signal_num)\n{\n  if(signal_num != SIGINT)\n  {\n    my_crash_handler(\"\\n\\nGURU MEDITATION: Signal handler has been invoked, application will exit!\\n\\n\");\n  }\n  else\n  {\n    my_crash_handler(\"\\n\\nGURU MEDITATION: Operation has been interrupted, application will exit!\\n\\n\");\n  }\n}\n\nvoid SYSTEM_INIT(const bool &debugMode)\n{\n  static const int signal_num[6] = { SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV, SIGTERM };\n\n  if(!debugMode)\n  {\n    for(size_t i = 0; i < 6; i++)\n    {\n      struct sigaction sa;\n      sa.sa_handler = my_signal_handler;\n      sigemptyset(&sa.sa_mask);\n      sa.sa_flags = SA_RESTART;\n      sigaction(signal_num[i], &sa, NULL);\n    }\n  }\n}\n\n#endif // __APPLE__\n"
  },
  {
    "path": "DynamicAudioNormalizerCLI/src/Platform_Win32.cpp",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Utility\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This program is free software; you can redistribute it and/or\n// modify it under the terms of the GNU General Public License\n// as published by the Free Software Foundation; either version 2\n// of the License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n//\n// http://www.gnu.org/licenses/gpl-2.0.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#include \"Platform.h\"\n\n#ifdef _WIN32\n\n#define WIN32_LEAN_AND_MEAN\n#include <Windows.h>\n\n#include <csignal>\n#include <io.h>\n#include <fcntl.h>\n\n#ifdef __MINGW32__\nextern \"C\"\n{\n\ttypedef struct { int newmode; } _startupinfo;\n\tint __cdecl __declspec(dllimport) __wgetmainargs (int *_Argc, wchar_t ***_Argv, wchar_t ***_Env, int _DoWildCard, _startupinfo * _StartInfo);\n\tint wmain(int argc, CHR* argv[]);\n}\n#endif //__MINGW32__\n\nstatic void my_crash_handler(const char *const message)\n{\n\tTRY_SEH\n\t{\n\t\tDWORD bytesWritten;\n\t\tif(HANDLE hStdErr = GetStdHandle(STD_ERROR_HANDLE))\n\t\t{\n\t\t\tWriteFile(hStdErr, message, lstrlenA(message), &bytesWritten, NULL);\n\t\t\tFlushFileBuffers(hStdErr);\n\t\t}\n\t}\n\tCATCH_SEH\n\t{\n\t\t/*ignore any exception that might occur in crash handler*/\n\t}\n\tfor(;;)\n\t{\n\t\tTerminateProcess(GetCurrentProcess(), 666);\n\t}\n}\n\nstatic void my_invalid_param_handler(const wchar_t*, const wchar_t*, const wchar_t*, unsigned int, uintptr_t)\n{\n\tmy_crash_handler(\"\\n\\nGURU MEDITATION: Invalid parameter handler invoked, application will exit!\\n\\n\");\n}\n\nstatic void my_signal_handler(int signal_num)\n{\n\tsignal(signal_num, my_signal_handler);\n\n\tif(signal_num != SIGINT)\n\t{\n\t\tmy_crash_handler(\"\\n\\nGURU MEDITATION: Signal handler has been invoked, application will exit!\\n\\n\");\n\t}\n\telse\n\t{\n\t\tmy_crash_handler(\"\\n\\nGURU MEDITATION: Operation has been interrupted, application will exit!\\n\\n\");\n\t}\n}\n\nstatic LONG WINAPI my_exception_handler(struct _EXCEPTION_POINTERS*)\n{\n\tmy_crash_handler(\"\\n\\nGURU MEDITATION: Unhandeled exception handler invoked, application will exit!\\n\");\n\treturn EXCEPTION_EXECUTE_HANDLER;\n}\n\nvoid SYSTEM_INIT(const bool &debugMode)\n{\n\tstatic const int signal_num[6] = { SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV, SIGTERM };\n\n\tif(!debugMode)\n\t{\n\t\tSetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);\n\t\tSetUnhandledExceptionFilter(my_exception_handler);\n\t\t_set_invalid_parameter_handler(my_invalid_param_handler);\n\n\t\tfor(size_t i = 0; i < 6; i++)\n\t\t{\n\t\t\tsignal(signal_num[i], my_signal_handler);\n\t\t}\n\t}\n\n\tSetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);\n\n\t_setmode(_fileno(stdin ), _O_BINARY);\n\t_setmode(_fileno(stdout), _O_BINARY);\n}\n\n//MinGW does *not* provide a proper wmain() entry point, so we have to emulate it here!\n#ifdef __MINGW32__\nint main()\n{\n\tint argc;\n\twchar_t **argv_wide, **envp_wide;\n\t_startupinfo startup = { 0 };\n\tif(__wgetmainargs(&argc, &argv_wide, &envp_wide, 0, &startup) != 0)\n\t{\n\t\tabort();\n\t}\n\treturn wmain(argc, argv_wide);\n}\n#endif //__MINGW32__\n\n#endif //_WIN32\n"
  },
  {
    "path": "DynamicAudioNormalizerGUI/DynamicAudioNormalizerGUI.qrc",
    "content": "<!DOCTYPE RCC>\n<RCC version=\"1.0\">\n\t<qresource>\n\t\t<file>res/chart_curve.png</file>\n\t</qresource>\n</RCC>\n"
  },
  {
    "path": "DynamicAudioNormalizerGUI/DynamicAudioNormalizerGUI_VS2013.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"12.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"Debug|Win32\">\n      <Configuration>Debug</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|Win32\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|Win32\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\3rd_party\\qcustomplot.cpp\" />\n    <ClCompile Include=\"src\\Main.cpp\" />\n    <ClCompile Include=\"src\\WinMain.cpp\" />\n    <ClCompile Include=\"tmp\\MOC_qcustomplot.cpp\" />\n    <ClCompile Include=\"tmp\\QRC_DynamicAudioNormalizerGUI.cpp\" />\n  </ItemGroup>\n  <ItemGroup>\n    <CustomBuild Include=\"src\\3rd_party\\qcustomplot.h\">\n      <Command Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\"$(QTDIR)\\bin\\moc.exe\" -o \"$(ProjectDir)tmp\\MOC_%(Filename).cpp\" \"%(FullPath)\"</Command>\n      <Message Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">MOC \"$(ProjectDir)tmp\\MOC_%(Filename).cpp\"</Message>\n      <Command Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\"$(QTDIR)\\bin\\moc.exe\" -o \"$(ProjectDir)tmp\\MOC_%(Filename).cpp\" \"%(FullPath)\"</Command>\n      <Command Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\"$(QTDIR)\\bin\\moc.exe\" -o \"$(ProjectDir)tmp\\MOC_%(Filename).cpp\" \"%(FullPath)\"</Command>\n      <Message Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">MOC \"$(ProjectDir)tmp\\MOC_%(Filename).cpp\"</Message>\n      <Message Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">MOC \"$(ProjectDir)tmp\\MOC_%(Filename).cpp\"</Message>\n      <Outputs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">$(ProjectDir)tmp\\MOC_%(Filename).cpp;%(Outputs)</Outputs>\n      <Outputs Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">$(ProjectDir)tmp\\MOC_%(Filename).cpp;%(Outputs)</Outputs>\n      <Outputs Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">$(ProjectDir)tmp\\MOC_%(Filename).cpp;%(Outputs)</Outputs>\n    </CustomBuild>\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"DynamicAudioNormalizerGUI.rc\">\n      <FileType>RES</FileType>\n    </ResourceCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <CustomBuild Include=\"DynamicAudioNormalizerGUI.qrc\">\n      <FileType>Document</FileType>\n      <Command Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\"$(QTDIR)\\bin\\rcc.exe\" -o \"$(ProjectDir)tmp\\QRC_%(Filename).cpp\" -name \"%(Filename)\" \"%(FullPath)\"</Command>\n      <Message Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">RCC \"$(ProjectDir)tmp\\QRC_%(Filename).cpp\"</Message>\n      <Outputs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">$(ProjectDir)tmp\\QRC_%(Filename).cpp;%(Outputs)</Outputs>\n      <Command Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\"$(QTDIR)\\bin\\rcc.exe\" -o \"$(ProjectDir)tmp\\QRC_%(Filename).cpp\" -name \"%(Filename)\" \"%(FullPath)\"</Command>\n      <Message Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">RCC \"$(ProjectDir)tmp\\QRC_%(Filename).cpp\"</Message>\n      <Outputs Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">$(ProjectDir)tmp\\QRC_%(Filename).cpp;%(Outputs)</Outputs>\n      <Command Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\"$(QTDIR)\\bin\\rcc.exe\" -o \"$(ProjectDir)tmp\\QRC_%(Filename).cpp\" -name \"%(Filename)\" \"%(FullPath)\"</Command>\n      <Message Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">RCC \"$(ProjectDir)tmp\\QRC_%(Filename).cpp\"</Message>\n      <Outputs Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">$(ProjectDir)tmp\\QRC_%(Filename).cpp;%(Outputs)</Outputs>\n    </CustomBuild>\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\DynamicAudioNormalizerAPI\\DynamicAudioNormalizerAPI_VS2013.vcxproj\">\n      <Project>{376386ee-8268-47e3-a335-7663716e4c60}</Project>\n      <Private>true</Private>\n      <ReferenceOutputAssembly>true</ReferenceOutputAssembly>\n      <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>\n      <LinkLibraryDependencies>true</LinkLibraryDependencies>\n      <UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>\n    </ProjectReference>\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <ProjectGuid>{131C921A-7144-4C1D-9C97-57C43FA83DFE}</ProjectGuid>\n    <Keyword>Win32Proj</Keyword>\n    <RootNamespace>DynamicAudioNormalizerGUI</RootNamespace>\n    <ProjectName>DynamicAudioNormalizerGUI</ProjectName>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>Application</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>Application</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>Application</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <LinkIncremental>true</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <ClCompile>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_DLL;QT_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(QTDIR)\\include;$(QTDIR)\\include\\QtCore;$(QTDIR)\\include\\QtGUI</AdditionalIncludeDirectories>\n      <EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\Qt4\\$(PlatformToolset)\\Debug\\lib</AdditionalLibraryDirectories>\n      <AdditionalDependencies>QtCored4.lib;QtGuid4.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <EntryPointSymbol>win32EntryPoint</EntryPointSymbol>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_DLL;QT_NO_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(QTDIR)\\include;$(QTDIR)\\include\\QtCore;$(QTDIR)\\include\\QtGUI</AdditionalIncludeDirectories>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <FloatingPointModel>Fast</FloatingPointModel>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\Qt4\\$(PlatformToolset)\\Shared\\lib</AdditionalLibraryDirectories>\n      <AdditionalDependencies>QtCore4.lib;QtGui4.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <EntryPointSymbol Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">win32EntryPoint</EntryPointSymbol>\n      <EntryPointSymbol Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">win32EntryPoint</EntryPointSymbol>\n      <EntryPointSymbol Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">win32EntryPoint</EntryPointSymbol>\n      <EntryPointSymbol Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">win32EntryPoint</EntryPointSymbol>\n      <EntryPointSymbol Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">win32EntryPoint</EntryPointSymbol>\n      <EntryPointSymbol>win32EntryPoint</EntryPointSymbol>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_NODLL;QT_NO_DEBUG;MDYNAMICAUDIONORMALIZER_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(QTDIR)\\include;$(QTDIR)\\include\\QtCore;$(QTDIR)\\include\\QtGUI</AdditionalIncludeDirectories>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n      <FloatingPointModel>Fast</FloatingPointModel>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\lib\\Win32\\static;$(SolutionDir)\\..\\Prerequisites\\Qt4\\$(PlatformToolset)\\Static\\lib</AdditionalLibraryDirectories>\n      <AdditionalDependencies>QtCore.lib;QtGui.lib;Imm32.lib;Winmm.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <EntryPointSymbol>win32EntryPoint</EntryPointSymbol>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerGUI/DynamicAudioNormalizerGUI_VS2013.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n    <Filter Include=\"Source Files\\3rd Party Sources\">\n      <UniqueIdentifier>{2f1efda3-3e92-4158-960c-40e4ceaf03ba}</UniqueIdentifier>\n    </Filter>\n    <Filter Include=\"Source Files\\Generated Files\">\n      <UniqueIdentifier>{7867be34-0625-4766-8937-eb65d6ae1533}</UniqueIdentifier>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\Main.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\3rd_party\\qcustomplot.cpp\">\n      <Filter>Source Files\\3rd Party Sources</Filter>\n    </ClCompile>\n    <ClCompile Include=\"tmp\\MOC_qcustomplot.cpp\">\n      <Filter>Source Files\\Generated Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\WinMain.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"tmp\\QRC_DynamicAudioNormalizerGUI.cpp\">\n      <Filter>Source Files\\Generated Files</Filter>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <CustomBuild Include=\"src\\3rd_party\\qcustomplot.h\">\n      <Filter>Header Files</Filter>\n    </CustomBuild>\n    <CustomBuild Include=\"DynamicAudioNormalizerGUI.qrc\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"DynamicAudioNormalizerGUI.rc\">\n      <Filter>Resource Files</Filter>\n    </ResourceCompile>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerGUI/DynamicAudioNormalizerGUI_VS2015.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"14.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"Debug|Win32\">\n      <Configuration>Debug</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|Win32\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|Win32\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\3rd_party\\qcustomplot.cpp\" />\n    <ClCompile Include=\"src\\Main.cpp\" />\n    <ClCompile Include=\"src\\WinMain.cpp\" />\n    <ClCompile Include=\"tmp\\MOC_qcustomplot.cpp\" />\n    <ClCompile Include=\"tmp\\QRC_DynamicAudioNormalizerGUI.cpp\" />\n  </ItemGroup>\n  <ItemGroup>\n    <CustomBuild Include=\"src\\3rd_party\\qcustomplot.h\">\n      <Command Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\"$(QTDIR)\\bin\\moc.exe\" -o \"$(ProjectDir)tmp\\MOC_%(Filename).cpp\" \"%(FullPath)\"</Command>\n      <Message Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">MOC \"$(ProjectDir)tmp\\MOC_%(Filename).cpp\"</Message>\n      <Command Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\"$(QTDIR)\\bin\\moc.exe\" -o \"$(ProjectDir)tmp\\MOC_%(Filename).cpp\" \"%(FullPath)\"</Command>\n      <Command Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\"$(QTDIR)\\bin\\moc.exe\" -o \"$(ProjectDir)tmp\\MOC_%(Filename).cpp\" \"%(FullPath)\"</Command>\n      <Message Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">MOC \"$(ProjectDir)tmp\\MOC_%(Filename).cpp\"</Message>\n      <Message Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">MOC \"$(ProjectDir)tmp\\MOC_%(Filename).cpp\"</Message>\n      <Outputs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">$(ProjectDir)tmp\\MOC_%(Filename).cpp;%(Outputs)</Outputs>\n      <Outputs Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">$(ProjectDir)tmp\\MOC_%(Filename).cpp;%(Outputs)</Outputs>\n      <Outputs Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">$(ProjectDir)tmp\\MOC_%(Filename).cpp;%(Outputs)</Outputs>\n    </CustomBuild>\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"DynamicAudioNormalizerGUI.rc\">\n      <FileType>RES</FileType>\n    </ResourceCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <CustomBuild Include=\"DynamicAudioNormalizerGUI.qrc\">\n      <FileType>Document</FileType>\n      <Command Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\"$(QTDIR)\\bin\\rcc.exe\" -o \"$(ProjectDir)tmp\\QRC_%(Filename).cpp\" -name \"%(Filename)\" \"%(FullPath)\"</Command>\n      <Message Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">RCC \"$(ProjectDir)tmp\\QRC_%(Filename).cpp\"</Message>\n      <Outputs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">$(ProjectDir)tmp\\QRC_%(Filename).cpp;%(Outputs)</Outputs>\n      <Command Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\"$(QTDIR)\\bin\\rcc.exe\" -o \"$(ProjectDir)tmp\\QRC_%(Filename).cpp\" -name \"%(Filename)\" \"%(FullPath)\"</Command>\n      <Message Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">RCC \"$(ProjectDir)tmp\\QRC_%(Filename).cpp\"</Message>\n      <Outputs Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">$(ProjectDir)tmp\\QRC_%(Filename).cpp;%(Outputs)</Outputs>\n      <Command Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\"$(QTDIR)\\bin\\rcc.exe\" -o \"$(ProjectDir)tmp\\QRC_%(Filename).cpp\" -name \"%(Filename)\" \"%(FullPath)\"</Command>\n      <Message Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">RCC \"$(ProjectDir)tmp\\QRC_%(Filename).cpp\"</Message>\n      <Outputs Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">$(ProjectDir)tmp\\QRC_%(Filename).cpp;%(Outputs)</Outputs>\n    </CustomBuild>\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\DynamicAudioNormalizerAPI\\DynamicAudioNormalizerAPI_VS2015.vcxproj\">\n      <Project>{376386ee-8268-47e3-a335-7663716e4c60}</Project>\n      <Private>true</Private>\n      <ReferenceOutputAssembly>true</ReferenceOutputAssembly>\n      <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>\n      <LinkLibraryDependencies>true</LinkLibraryDependencies>\n      <UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>\n    </ProjectReference>\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <ProjectGuid>{131C921A-7144-4C1D-9C97-57C43FA83DFE}</ProjectGuid>\n    <Keyword>Win32Proj</Keyword>\n    <RootNamespace>DynamicAudioNormalizerGUI</RootNamespace>\n    <ProjectName>DynamicAudioNormalizerGUI</ProjectName>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>Application</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>Application</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>Application</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <LinkIncremental>true</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <ClCompile>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_DLL;QT_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(QTDIR)\\include;$(QTDIR)\\include\\QtCore;$(QTDIR)\\include\\QtGUI</AdditionalIncludeDirectories>\n      <EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\Qt4\\$(PlatformToolset)\\Debug\\lib</AdditionalLibraryDirectories>\n      <AdditionalDependencies>QtCored4.lib;QtGuid4.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <EntryPointSymbol>win32EntryPoint</EntryPointSymbol>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_DLL;QT_NO_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(QTDIR)\\include;$(QTDIR)\\include\\QtCore;$(QTDIR)\\include\\QtGUI</AdditionalIncludeDirectories>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <FloatingPointModel>Fast</FloatingPointModel>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\Qt4\\$(PlatformToolset)\\Shared\\lib</AdditionalLibraryDirectories>\n      <AdditionalDependencies>QtCore4.lib;QtGui4.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <EntryPointSymbol Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">win32EntryPoint</EntryPointSymbol>\n      <EntryPointSymbol Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">win32EntryPoint</EntryPointSymbol>\n      <EntryPointSymbol Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">win32EntryPoint</EntryPointSymbol>\n      <EntryPointSymbol Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">win32EntryPoint</EntryPointSymbol>\n      <EntryPointSymbol Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">win32EntryPoint</EntryPointSymbol>\n      <EntryPointSymbol>win32EntryPoint</EntryPointSymbol>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_NODLL;QT_NO_DEBUG;MDYNAMICAUDIONORMALIZER_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(QTDIR)\\include;$(QTDIR)\\include\\QtCore;$(QTDIR)\\include\\QtGUI</AdditionalIncludeDirectories>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n      <FloatingPointModel>Fast</FloatingPointModel>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\lib\\Win32\\static;$(SolutionDir)\\..\\Prerequisites\\Qt4\\$(PlatformToolset)\\Static\\lib</AdditionalLibraryDirectories>\n      <AdditionalDependencies>QtCore.lib;QtGui.lib;Imm32.lib;Winmm.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <EntryPointSymbol>win32EntryPoint</EntryPointSymbol>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerGUI/DynamicAudioNormalizerGUI_VS2015.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n    <Filter Include=\"Source Files\\3rd Party Sources\">\n      <UniqueIdentifier>{2f1efda3-3e92-4158-960c-40e4ceaf03ba}</UniqueIdentifier>\n    </Filter>\n    <Filter Include=\"Source Files\\Generated Files\">\n      <UniqueIdentifier>{7867be34-0625-4766-8937-eb65d6ae1533}</UniqueIdentifier>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\Main.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\3rd_party\\qcustomplot.cpp\">\n      <Filter>Source Files\\3rd Party Sources</Filter>\n    </ClCompile>\n    <ClCompile Include=\"tmp\\MOC_qcustomplot.cpp\">\n      <Filter>Source Files\\Generated Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\WinMain.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"tmp\\QRC_DynamicAudioNormalizerGUI.cpp\">\n      <Filter>Source Files\\Generated Files</Filter>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <CustomBuild Include=\"src\\3rd_party\\qcustomplot.h\">\n      <Filter>Header Files</Filter>\n    </CustomBuild>\n    <CustomBuild Include=\"DynamicAudioNormalizerGUI.qrc\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"DynamicAudioNormalizerGUI.rc\">\n      <Filter>Resource Files</Filter>\n    </ResourceCompile>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerGUI/DynamicAudioNormalizerGUI_VS2017.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"14.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"Debug|Win32\">\n      <Configuration>Debug</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|Win32\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|Win32\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\3rd_party\\qcustomplot.cpp\" />\n    <ClCompile Include=\"src\\Main.cpp\" />\n    <ClCompile Include=\"src\\WinMain.cpp\" />\n    <ClCompile Include=\"tmp\\MOC_qcustomplot.cpp\" />\n    <ClCompile Include=\"tmp\\QRC_DynamicAudioNormalizerGUI.cpp\" />\n  </ItemGroup>\n  <ItemGroup>\n    <CustomBuild Include=\"src\\3rd_party\\qcustomplot.h\">\n      <Command Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\"$(QTDIR)\\bin\\moc.exe\" -o \"$(ProjectDir)tmp\\MOC_%(Filename).cpp\" \"%(FullPath)\"</Command>\n      <Message Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">MOC \"$(ProjectDir)tmp\\MOC_%(Filename).cpp\"</Message>\n      <Command Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\"$(QTDIR)\\bin\\moc.exe\" -o \"$(ProjectDir)tmp\\MOC_%(Filename).cpp\" \"%(FullPath)\"</Command>\n      <Command Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\"$(QTDIR)\\bin\\moc.exe\" -o \"$(ProjectDir)tmp\\MOC_%(Filename).cpp\" \"%(FullPath)\"</Command>\n      <Message Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">MOC \"$(ProjectDir)tmp\\MOC_%(Filename).cpp\"</Message>\n      <Message Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">MOC \"$(ProjectDir)tmp\\MOC_%(Filename).cpp\"</Message>\n      <Outputs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">$(ProjectDir)tmp\\MOC_%(Filename).cpp;%(Outputs)</Outputs>\n      <Outputs Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">$(ProjectDir)tmp\\MOC_%(Filename).cpp;%(Outputs)</Outputs>\n      <Outputs Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">$(ProjectDir)tmp\\MOC_%(Filename).cpp;%(Outputs)</Outputs>\n    </CustomBuild>\n  </ItemGroup>\n  <ItemGroup>\n    <CustomBuild Include=\"DynamicAudioNormalizerGUI.qrc\">\n      <FileType>Document</FileType>\n      <Command Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\"$(QTDIR)\\bin\\rcc.exe\" -o \"$(ProjectDir)tmp\\QRC_%(Filename).cpp\" -name \"%(Filename)\" \"%(FullPath)\"</Command>\n      <Message Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">RCC \"$(ProjectDir)tmp\\QRC_%(Filename).cpp\"</Message>\n      <Outputs Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">$(ProjectDir)tmp\\QRC_%(Filename).cpp;%(Outputs)</Outputs>\n      <Command Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\"$(QTDIR)\\bin\\rcc.exe\" -o \"$(ProjectDir)tmp\\QRC_%(Filename).cpp\" -name \"%(Filename)\" \"%(FullPath)\"</Command>\n      <Message Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">RCC \"$(ProjectDir)tmp\\QRC_%(Filename).cpp\"</Message>\n      <Outputs Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">$(ProjectDir)tmp\\QRC_%(Filename).cpp;%(Outputs)</Outputs>\n      <Command Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\"$(QTDIR)\\bin\\rcc.exe\" -o \"$(ProjectDir)tmp\\QRC_%(Filename).cpp\" -name \"%(Filename)\" \"%(FullPath)\"</Command>\n      <Message Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">RCC \"$(ProjectDir)tmp\\QRC_%(Filename).cpp\"</Message>\n      <Outputs Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">$(ProjectDir)tmp\\QRC_%(Filename).cpp;%(Outputs)</Outputs>\n    </CustomBuild>\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\DynamicAudioNormalizerAPI\\DynamicAudioNormalizerAPI_VS2017.vcxproj\">\n      <Project>{376386ee-8268-47e3-a335-7663716e4c60}</Project>\n      <Private>true</Private>\n      <ReferenceOutputAssembly>true</ReferenceOutputAssembly>\n      <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>\n      <LinkLibraryDependencies>true</LinkLibraryDependencies>\n      <UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>\n    </ProjectReference>\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"res\\DynamicAudioNormalizerGUI.rc\" />\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <ProjectGuid>{131C921A-7144-4C1D-9C97-57C43FA83DFE}</ProjectGuid>\n    <Keyword>Win32Proj</Keyword>\n    <RootNamespace>DynamicAudioNormalizerGUI</RootNamespace>\n    <ProjectName>DynamicAudioNormalizerGUI</ProjectName>\n    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>Application</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>Application</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>Application</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <LinkIncremental>true</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <ClCompile>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_DLL;QT_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(QTDIR)\\include;$(QTDIR)\\include\\QtCore;$(QTDIR)\\include\\QtGUI</AdditionalIncludeDirectories>\n      <EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\Qt4\\$(PlatformToolset)\\Debug\\lib</AdditionalLibraryDirectories>\n      <AdditionalDependencies>QtCored4.lib;QtGuid4.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <EntryPointSymbol>win32EntryPoint</EntryPointSymbol>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <Optimization>MinSpace</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_DLL;QT_NO_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(QTDIR)\\include;$(QTDIR)\\include\\QtCore;$(QTDIR)\\include\\QtGUI</AdditionalIncludeDirectories>\n      <InlineFunctionExpansion>Default</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <WholeProgramOptimization>false</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\Qt4\\$(PlatformToolset)\\Shared\\lib</AdditionalLibraryDirectories>\n      <AdditionalDependencies>QtCore4.lib;QtGui4.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <EntryPointSymbol Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">win32EntryPoint</EntryPointSymbol>\n      <EntryPointSymbol Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">win32EntryPoint</EntryPointSymbol>\n      <EntryPointSymbol Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">win32EntryPoint</EntryPointSymbol>\n      <EntryPointSymbol Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">win32EntryPoint</EntryPointSymbol>\n      <EntryPointSymbol Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">win32EntryPoint</EntryPointSymbol>\n      <EntryPointSymbol>win32EntryPoint</EntryPointSymbol>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n    <Manifest>\n      <AdditionalManifestFiles>$(SolutionDir)DynamicAudioNormalizerShared\\res\\compat.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>\n    </Manifest>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <Optimization>MinSpace</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;QT_GUI_LIB;QT_CORE_LIB;QT_THREAD_SUPPORT;QT_NODLL;QT_NO_DEBUG;MDYNAMICAUDIONORMALIZER_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(QTDIR)\\include;$(QTDIR)\\include\\QtCore;$(QTDIR)\\include\\QtGUI</AdditionalIncludeDirectories>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <InlineFunctionExpansion>Default</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <WholeProgramOptimization>false</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\lib\\Win32\\static;$(SolutionDir)\\..\\Prerequisites\\Qt4\\$(PlatformToolset)\\Static\\lib</AdditionalLibraryDirectories>\n      <AdditionalDependencies>QtCore.lib;QtGui.lib;Imm32.lib;Winmm.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <EntryPointSymbol>win32EntryPoint</EntryPointSymbol>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n    <Manifest>\n      <AdditionalManifestFiles>$(SolutionDir)DynamicAudioNormalizerShared\\res\\compat.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>\n    </Manifest>\n  </ItemDefinitionGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerGUI/DynamicAudioNormalizerGUI_VS2017.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n    <Filter Include=\"Source Files\\3rd Party Sources\">\n      <UniqueIdentifier>{2f1efda3-3e92-4158-960c-40e4ceaf03ba}</UniqueIdentifier>\n    </Filter>\n    <Filter Include=\"Source Files\\Generated Files\">\n      <UniqueIdentifier>{7867be34-0625-4766-8937-eb65d6ae1533}</UniqueIdentifier>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\Main.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\3rd_party\\qcustomplot.cpp\">\n      <Filter>Source Files\\3rd Party Sources</Filter>\n    </ClCompile>\n    <ClCompile Include=\"tmp\\MOC_qcustomplot.cpp\">\n      <Filter>Source Files\\Generated Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\WinMain.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"tmp\\QRC_DynamicAudioNormalizerGUI.cpp\">\n      <Filter>Source Files\\Generated Files</Filter>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <CustomBuild Include=\"src\\3rd_party\\qcustomplot.h\">\n      <Filter>Header Files</Filter>\n    </CustomBuild>\n    <CustomBuild Include=\"DynamicAudioNormalizerGUI.qrc\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"res\\DynamicAudioNormalizerGUI.rc\">\n      <Filter>Resource Files</Filter>\n    </ResourceCompile>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerGUI/makefile",
    "content": "##############################################################################\n# Dynamic Audio Normalizer - Audio Processing Utility\n# Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n#\n# http://www.gnu.org/licenses/gpl-3.0.txt\n##############################################################################\n\nECHO=echo -e\nSHELL=/bin/bash\n\nMOC ?= moc\nQTDIR ?= /usr/include/qt4\n\n##############################################################################\n# Constants\n##############################################################################\n\nPROGRAM_NAME := DynamicAudioNormalizerGUI\n\nifndef API_VERSION\n   $(error API_VERSION variable is not set!)\nendif\n\n##############################################################################\n# Qt Checks\n##############################################################################\n\nifneq ($(MAKECMDGOALS),clean)\n   MOC_CHECK := $(findstring Qt Meta Object Compiler,$(shell $(MOC) -v 2>&1))\n   ifneq ($(MOC_CHECK),Qt Meta Object Compiler)\n      $(error Qt Meta Object Compiler not found. Please set MOC environment variable properly!)\n   endif\n   ifneq ($(notdir $(realpath $(QTDIR)/QtGui/QApplication)),QApplication)\n      $(error File \"QtGui/QApplication\" not found in Qt include path. Please set QTDIR environment variable properly!)\n   endif\nendif\n\n##############################################################################\n# Flags\n##############################################################################\n\nDEBUG_BUILD ?= 0\nMARCH ?= native\n\nifeq ($(DEBUG_BUILD), 1)\n   CONFIG_NAME = Debug\n   CXXFLAGS = -g -O0 -D_DEBUG\nelse\n   CONFIG_NAME = Release\n   CXXFLAGS = -O3 -Wall -ffast-math -mfpmath=sse -msse -fomit-frame-pointer -fno-tree-vectorize -DNDEBUG -march=$(MARCH) -Wno-strict-overflow\nendif\n\nCXXFLAGS += -I./src\nCXXFLAGS += -I../DynamicAudioNormalizerAPI/include\n\nLDXFLAGS += -Wl,-rpath,'$$ORIGIN'\nLDXFLAGS += -L../DynamicAudioNormalizerAPI/lib\nLDXFLAGS += -lDynamicAudioNormalizerAPI-$(API_VERSION)\n\n#Externel libraries\nCXXFLAGS += -I$(QTDIR)\nCXXFLAGS += -I$(QTDIR)/QtGui\nCXXFLAGS += -I$(QTDIR)/QtCore\n\nLDXFLAGS += -lQtCore -lQtGui\n\n##############################################################################\n# File Names\n##############################################################################\n\nifeq ($(findstring MINGW,$(shell uname -s)),MINGW)\n   PRG_EXT = exe\nelse\n   PRG_EXT = bin\nendif\n\nSOURCES_HDR = $(wildcard src/*.h) $(wildcard src/3rd_party/*.h)\nSOURCES_MOC = $(patsubst %.h,%_MOC.cpp,$(SOURCES_HDR))\nSOURCES_CPP = $(wildcard src/*.cpp) $(wildcard src/3rd_party/*.cpp) $(SOURCES_MOC)\nSOURCES_OBJ = $(patsubst %.cpp,%.o,$(SOURCES_CPP))\n\nPROGRAM_OUT = bin/$(PROGRAM_NAME)\nPROGRAM_BIN = $(PROGRAM_OUT).$(PRG_EXT)\nPROGRAM_DBG = $(PROGRAM_OUT)-DBG.$(PRG_EXT)\n\n##############################################################################\n# Rules\n##############################################################################\n\n.PHONY: all clean\n\nall: $(PROGRAM_BIN)\n\n#-------------------------------------------------------------\n# Link & Strip\n#-------------------------------------------------------------\n\n$(PROGRAM_BIN): $(PROGRAM_DBG)\n\t@$(ECHO) \"\\e[1;36m[STR] $@\\e[0m\"\n\t@mkdir -p $(dir $@)\n\tstrip --strip-unneeded -o $@ $<\n\n$(PROGRAM_DBG): $(SOURCES_OBJ)\n\t@$(ECHO) \"\\e[1;36m[LNK] $@\\e[0m\"\n\t@mkdir -p $(dir $@)\n\tg++ -o $@ $+ $(LDXFLAGS)\n\n#-------------------------------------------------------------\n# Compile\n#-------------------------------------------------------------\n\n%_MOC.cpp: %.h\n\t@$(ECHO) \"\\e[1;36m[MOC] $<\\e[0m\"\n\t@mkdir -p $(dir $@)\n\t$(MOC) -o $@ $<\n\n%.o: %.cpp\n\t@$(ECHO) \"\\e[1;36m[CXX] $<\\e[0m\"\n\t@mkdir -p $(dir $@)\n\tg++ $(CXXFLAGS) -c $< -o $@\n\n#-------------------------------------------------------------\n# Clean\n#-------------------------------------------------------------\n\nclean:\n\trm -fv $(SOURCES_OBJ)\n\trm -fv $(SOURCES_MOC)\n\trm -rfv ./bin\n\n"
  },
  {
    "path": "DynamicAudioNormalizerGUI/res/DynamicAudioNormalizerGUI.rc",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Library\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This library is free software; you can redistribute it and/or\n// modify it under the terms of the GNU Lesser General Public\n// License as published by the Free Software Foundation; either\n// version 2.1 of the License, or (at your option) any later version.\n//\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public\n// License along with this library; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n//\n// http://www.gnu.org/licenses/lgpl-2.1.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#include \"WinResrc.h\" //\"afxres.h\"\n\n#define INC_DYNAUDNORM_VERSION_INTERNAL 0x22b4f8a9\n#include \"../DynamicAudioNormalizerShared/res/version.inc\"\n\n//////////////////////////////////////////////////////////////////////////////////\n// Neutral resources\n//////////////////////////////////////////////////////////////////////////////////\n\n#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)\n#ifdef _WIN32\nLANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL\n#pragma code_page(1252)\n#endif //_WIN32\n\n//////////////////////////////////////////////////////////////////////////////////\n// Icon\n//////////////////////////////////////////////////////////////////////////////////\n\n101 ICON \"DynamicAudioNormalizerGUI.ico\"\n\n//////////////////////////////////////////////////////////////////////////////////\n// Version\n//////////////////////////////////////////////////////////////////////////////////\n\nVS_VERSION_INFO VERSIONINFO\n FILEVERSION    VER_DYNAUDNORM_MAJOR,VER_DYNAUDNORM_MINOR_HI,VER_DYNAUDNORM_MINOR_LO,VER_DYNAUDNORM_PATCH\n PRODUCTVERSION VER_DYNAUDNORM_MAJOR,VER_DYNAUDNORM_MINOR_HI,VER_DYNAUDNORM_MINOR_LO,VER_DYNAUDNORM_PATCH\n FILEFLAGSMASK 0x17L\n#ifdef _DEBUG\n FILEFLAGS 0x3L\n#else\n FILEFLAGS 0x2L\n#endif\n FILEOS 0x40004L\n FILETYPE 0x1L\n FILESUBTYPE 0x0L\nBEGIN\n    BLOCK \"StringFileInfo\"\n    BEGIN\n        BLOCK \"000004b0\"\n        BEGIN\n            VALUE \"Comments\", \"This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License <http://www.gnu.org/>.\"\n            VALUE \"CompanyName\", \"LoRd_MuldeR <mulder2@gmx.de>\"\n            VALUE \"FileDescription\", \"DynamicAudioNormalizer Log Viewer\"\n            VALUE \"FileVersion\", VER_DYNAUDNORM_STR\n            VALUE \"InternalName\", \"DynamicAudioNormalizerGUI\"\n            VALUE \"LegalCopyright\", \"Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>\"\n            VALUE \"LegalTrademarks\", \"This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License <http://www.gnu.org/>\"\n            VALUE \"OriginalFilename\", \"DynamicAudioNormalizerGUI.exe\"\n            VALUE \"ProductName\", \"DynamicAudioNormalizer\"\n            VALUE \"ProductVersion\", VER_DYNAUDNORM_STR\n        END\n    END\n    BLOCK \"VarFileInfo\"\n    BEGIN\n        VALUE \"Translation\", 0x0, 1200\n    END\nEND\n\n#endif    // Neutral resources\n"
  },
  {
    "path": "DynamicAudioNormalizerGUI/src/3rd_party/qcustomplot.cpp",
    "content": "/***************************************************************************\n**                                                                        **\n**  QCustomPlot, an easy to use, modern plotting widget for Qt            **\n**  Copyright (C) 2011, 2012, 2013, 2014 Emanuel Eichhammer               **\n**                                                                        **\n**  This program is free software: you can redistribute it and/or modify  **\n**  it under the terms of the GNU General Public License as published by  **\n**  the Free Software Foundation, either version 3 of the License, or     **\n**  (at your option) any later version.                                   **\n**                                                                        **\n**  This program is distributed in the hope that it will be useful,       **\n**  but WITHOUT ANY WARRANTY; without even the implied warranty of        **\n**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         **\n**  GNU General Public License for more details.                          **\n**                                                                        **\n**  You should have received a copy of the GNU General Public License     **\n**  along with this program.  If not, see http://www.gnu.org/licenses/.   **\n**                                                                        **\n****************************************************************************\n**           Author: Emanuel Eichhammer                                   **\n**  Website/Contact: http://www.qcustomplot.com/                          **\n**             Date: 07.04.14                                             **\n**          Version: 1.2.1                                                **\n****************************************************************************/\n\n#include \"qcustomplot.h\"\n\n\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPPainter\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPPainter\n  \\brief QPainter subclass used internally\n  \n  This QPainter subclass is used to provide some extended functionality e.g. for tweaking position\n  consistency between antialiased and non-antialiased painting. Further it provides workarounds\n  for QPainter quirks.\n  \n  \\warning This class intentionally hides non-virtual functions of QPainter, e.g. setPen, save and\n  restore. So while it is possible to pass a QCPPainter instance to a function that expects a\n  QPainter pointer, some of the workarounds and tweaks will be unavailable to the function (because\n  it will call the base class implementations of the functions actually hidden by QCPPainter).\n*/\n\n/*!\n  Creates a new QCPPainter instance and sets default values\n*/\nQCPPainter::QCPPainter() :\n  QPainter(),\n  mModes(pmDefault),\n  mIsAntialiasing(false)\n{\n  // don't setRenderHint(QPainter::NonCosmeticDefautPen) here, because painter isn't active yet and\n  // a call to begin() will follow\n}\n\n/*!\n  Creates a new QCPPainter instance on the specified paint \\a device and sets default values. Just\n  like the analogous QPainter constructor, begins painting on \\a device immediately.\n  \n  Like \\ref begin, this method sets QPainter::NonCosmeticDefaultPen in Qt versions before Qt5.\n*/\nQCPPainter::QCPPainter(QPaintDevice *device) :\n  QPainter(device),\n  mModes(pmDefault),\n  mIsAntialiasing(false)\n{\n#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) // before Qt5, default pens used to be cosmetic if NonCosmeticDefaultPen flag isn't set. So we set it to get consistency across Qt versions.\n  if (isActive())\n    setRenderHint(QPainter::NonCosmeticDefaultPen);\n#endif\n}\n\nQCPPainter::~QCPPainter()\n{\n}\n\n/*!\n  Sets the pen of the painter and applies certain fixes to it, depending on the mode of this\n  QCPPainter.\n  \n  \\note this function hides the non-virtual base class implementation.\n*/\nvoid QCPPainter::setPen(const QPen &pen)\n{\n  QPainter::setPen(pen);\n  if (mModes.testFlag(pmNonCosmetic))\n    makeNonCosmetic();\n}\n\n/*! \\overload\n  \n  Sets the pen (by color) of the painter and applies certain fixes to it, depending on the mode of\n  this QCPPainter.\n  \n  \\note this function hides the non-virtual base class implementation.\n*/\nvoid QCPPainter::setPen(const QColor &color)\n{\n  QPainter::setPen(color);\n  if (mModes.testFlag(pmNonCosmetic))\n    makeNonCosmetic();\n}\n\n/*! \\overload\n  \n  Sets the pen (by style) of the painter and applies certain fixes to it, depending on the mode of\n  this QCPPainter.\n  \n  \\note this function hides the non-virtual base class implementation.\n*/\nvoid QCPPainter::setPen(Qt::PenStyle penStyle)\n{\n  QPainter::setPen(penStyle);\n  if (mModes.testFlag(pmNonCosmetic))\n    makeNonCosmetic();\n}\n\n/*! \\overload\n  \n  Works around a Qt bug introduced with Qt 4.8 which makes drawing QLineF unpredictable when\n  antialiasing is disabled. Thus when antialiasing is disabled, it rounds the \\a line to\n  integer coordinates and then passes it to the original drawLine.\n  \n  \\note this function hides the non-virtual base class implementation.\n*/\nvoid QCPPainter::drawLine(const QLineF &line)\n{\n  if (mIsAntialiasing || mModes.testFlag(pmVectorized))\n    QPainter::drawLine(line);\n  else\n    QPainter::drawLine(line.toLine());\n}\n\n/*!\n  Sets whether painting uses antialiasing or not. Use this method instead of using setRenderHint\n  with QPainter::Antialiasing directly, as it allows QCPPainter to regain pixel exactness between\n  antialiased and non-antialiased painting (Since Qt < 5.0 uses slightly different coordinate systems for\n  AA/Non-AA painting).\n*/\nvoid QCPPainter::setAntialiasing(bool enabled)\n{\n  setRenderHint(QPainter::Antialiasing, enabled);\n  if (mIsAntialiasing != enabled)\n  {\n    mIsAntialiasing = enabled;\n    if (!mModes.testFlag(pmVectorized)) // antialiasing half-pixel shift only needed for rasterized outputs\n    {\n      if (mIsAntialiasing)\n        translate(0.5, 0.5);\n      else\n        translate(-0.5, -0.5);\n    }\n  }\n}\n\n/*!\n  Sets the mode of the painter. This controls whether the painter shall adjust its\n  fixes/workarounds optimized for certain output devices.\n*/\nvoid QCPPainter::setModes(QCPPainter::PainterModes modes)\n{\n  mModes = modes;\n}\n\n/*!\n  Sets the QPainter::NonCosmeticDefaultPen in Qt versions before Qt5 after beginning painting on \\a\n  device. This is necessary to get cosmetic pen consistency across Qt versions, because since Qt5,\n  all pens are non-cosmetic by default, and in Qt4 this render hint must be set to get that\n  behaviour.\n  \n  The Constructor \\ref QCPPainter(QPaintDevice *device) which directly starts painting also sets\n  the render hint as appropriate.\n  \n  \\note this function hides the non-virtual base class implementation.\n*/\nbool QCPPainter::begin(QPaintDevice *device)\n{\n  bool result = QPainter::begin(device);\n#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) // before Qt5, default pens used to be cosmetic if NonCosmeticDefaultPen flag isn't set. So we set it to get consistency across Qt versions.\n  if (result)\n    setRenderHint(QPainter::NonCosmeticDefaultPen);\n#endif\n  return result;\n}\n\n/*! \\overload\n  \n  Sets the mode of the painter. This controls whether the painter shall adjust its\n  fixes/workarounds optimized for certain output devices.\n*/\nvoid QCPPainter::setMode(QCPPainter::PainterMode mode, bool enabled)\n{\n  if (!enabled && mModes.testFlag(mode))\n    mModes &= ~mode;\n  else if (enabled && !mModes.testFlag(mode))\n    mModes |= mode;\n}\n\n/*!\n  Saves the painter (see QPainter::save). Since QCPPainter adds some new internal state to\n  QPainter, the save/restore functions are reimplemented to also save/restore those members.\n  \n  \\note this function hides the non-virtual base class implementation.\n  \n  \\see restore\n*/\nvoid QCPPainter::save()\n{\n  mAntialiasingStack.push(mIsAntialiasing);\n  QPainter::save();\n}\n\n/*!\n  Restores the painter (see QPainter::restore). Since QCPPainter adds some new internal state to\n  QPainter, the save/restore functions are reimplemented to also save/restore those members.\n  \n  \\note this function hides the non-virtual base class implementation.\n  \n  \\see save\n*/\nvoid QCPPainter::restore()\n{\n  if (!mAntialiasingStack.isEmpty())\n    mIsAntialiasing = mAntialiasingStack.pop();\n  else\n    qDebug() << Q_FUNC_INFO << \"Unbalanced save/restore\";\n  QPainter::restore();\n}\n\n/*!\n  Changes the pen width to 1 if it currently is 0. This function is called in the \\ref setPen\n  overrides when the \\ref pmNonCosmetic mode is set.\n*/\nvoid QCPPainter::makeNonCosmetic()\n{\n  if (qFuzzyIsNull(pen().widthF()))\n  {\n    QPen p = pen();\n    p.setWidth(1);\n    QPainter::setPen(p);\n  }\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPScatterStyle\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPScatterStyle\n  \\brief Represents the visual appearance of scatter points\n  \n  This class holds information about shape, color and size of scatter points. In plottables like\n  QCPGraph it is used to store how scatter points shall be drawn. For example, \\ref\n  QCPGraph::setScatterStyle takes a QCPScatterStyle instance.\n  \n  A scatter style consists of a shape (\\ref setShape), a line color (\\ref setPen) and possibly a\n  fill (\\ref setBrush), if the shape provides a fillable area. Further, the size of the shape can\n  be controlled with \\ref setSize.\n\n  \\section QCPScatterStyle-defining Specifying a scatter style\n  \n  You can set all these configurations either by calling the respective functions on an instance:\n  \\code\n  QCPScatterStyle myScatter;\n  myScatter.setShape(QCPScatterStyle::ssCircle);\n  myScatter.setPen(Qt::blue);\n  myScatter.setBrush(Qt::white);\n  myScatter.setSize(5);\n  customPlot->graph(0)->setScatterStyle(myScatter);\n  \\endcode\n  \n  Or you can use one of the various constructors that take different parameter combinations, making\n  it easy to specify a scatter style in a single call, like so:\n  \\code\n  customPlot->graph(0)->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssCircle, Qt::blue, Qt::white, 5));\n  \\endcode\n  \n  \\section QCPScatterStyle-undefinedpen Leaving the color/pen up to the plottable\n  \n  There are two constructors which leave the pen undefined: \\ref QCPScatterStyle() and \\ref\n  QCPScatterStyle(ScatterShape shape, double size). If those constructors are used, a call to \\ref\n  isPenDefined will return false. It leads to scatter points that inherit the pen from the\n  plottable that uses the scatter style. Thus, if such a scatter style is passed to QCPGraph, the line\n  color of the graph (\\ref QCPGraph::setPen) will be used by the scatter points. This makes\n  it very convenient to set up typical scatter settings:\n  \n  \\code\n  customPlot->graph(0)->setScatterStyle(QCPScatterStyle::ssPlus);\n  \\endcode\n\n  Notice that it wasn't even necessary to explicitly call a QCPScatterStyle constructor. This works\n  because QCPScatterStyle provides a constructor that can transform a \\ref ScatterShape directly\n  into a QCPScatterStyle instance (that's the \\ref QCPScatterStyle(ScatterShape shape, double size)\n  constructor with a default for \\a size). In those cases, C++ allows directly supplying a \\ref\n  ScatterShape, where actually a QCPScatterStyle is expected.\n  \n  \\section QCPScatterStyle-custompath-and-pixmap Custom shapes and pixmaps\n  \n  QCPScatterStyle supports drawing custom shapes and arbitrary pixmaps as scatter points.\n\n  For custom shapes, you can provide a QPainterPath with the desired shape to the \\ref\n  setCustomPath function or call the constructor that takes a painter path. The scatter shape will\n  automatically be set to \\ref ssCustom.\n  \n  For pixmaps, you call \\ref setPixmap with the desired QPixmap. Alternatively you can use the\n  constructor that takes a QPixmap. The scatter shape will automatically be set to \\ref ssPixmap.\n  Note that \\ref setSize does not influence the appearance of the pixmap.\n*/\n\n/* start documentation of inline functions */\n\n/*! \\fn bool QCPScatterStyle::isNone() const\n  \n  Returns whether the scatter shape is \\ref ssNone.\n  \n  \\see setShape\n*/\n\n/*! \\fn bool QCPScatterStyle::isPenDefined() const\n  \n  Returns whether a pen has been defined for this scatter style.\n  \n  The pen is undefined if a constructor is called that does not carry \\a pen as parameter. Those are\n  \\ref QCPScatterStyle() and \\ref QCPScatterStyle(ScatterShape shape, double size). If the pen is\n  left undefined, the scatter color will be inherited from the plottable that uses this scatter\n  style.\n  \n  \\see setPen\n*/\n\n/* end documentation of inline functions */\n\n/*!\n  Creates a new QCPScatterStyle instance with size set to 6. No shape, pen or brush is defined.\n  \n  Since the pen is undefined (\\ref isPenDefined returns false), the scatter color will be inherited\n  from the plottable that uses this scatter style.\n*/\nQCPScatterStyle::QCPScatterStyle() :\n  mSize(6),\n  mShape(ssNone),\n  mPen(Qt::NoPen),\n  mBrush(Qt::NoBrush),\n  mPenDefined(false)\n{\n}\n\n/*!\n  Creates a new QCPScatterStyle instance with shape set to \\a shape and size to \\a size. No pen or\n  brush is defined.\n  \n  Since the pen is undefined (\\ref isPenDefined returns false), the scatter color will be inherited\n  from the plottable that uses this scatter style.\n*/\nQCPScatterStyle::QCPScatterStyle(ScatterShape shape, double size) :\n  mSize(size),\n  mShape(shape),\n  mPen(Qt::NoPen),\n  mBrush(Qt::NoBrush),\n  mPenDefined(false)\n{\n}\n\n/*!\n  Creates a new QCPScatterStyle instance with shape set to \\a shape, the pen color set to \\a color,\n  and size to \\a size. No brush is defined, i.e. the scatter point will not be filled.\n*/\nQCPScatterStyle::QCPScatterStyle(ScatterShape shape, const QColor &color, double size) :\n  mSize(size),\n  mShape(shape),\n  mPen(QPen(color)),\n  mBrush(Qt::NoBrush),\n  mPenDefined(true)\n{\n}\n\n/*!\n  Creates a new QCPScatterStyle instance with shape set to \\a shape, the pen color set to \\a color,\n  the brush color to \\a fill (with a solid pattern), and size to \\a size.\n*/\nQCPScatterStyle::QCPScatterStyle(ScatterShape shape, const QColor &color, const QColor &fill, double size) :\n  mSize(size),\n  mShape(shape),\n  mPen(QPen(color)),\n  mBrush(QBrush(fill)),\n  mPenDefined(true)\n{\n}\n\n/*!\n  Creates a new QCPScatterStyle instance with shape set to \\a shape, the pen set to \\a pen, the\n  brush to \\a brush, and size to \\a size.\n  \n  \\warning In some cases it might be tempting to directly use a pen style like <tt>Qt::NoPen</tt> as \\a pen\n  and a color like <tt>Qt::blue</tt> as \\a brush. Notice however, that the corresponding call\\n\n  <tt>QCPScatterStyle(QCPScatterShape::ssCircle, Qt::NoPen, Qt::blue, 5)</tt>\\n\n  doesn't necessarily lead C++ to use this constructor in some cases, but might mistake\n  <tt>Qt::NoPen</tt> for a QColor and use the\n  \\ref QCPScatterStyle(ScatterShape shape, const QColor &color, const QColor &fill, double size)\n  constructor instead (which will lead to an unexpected look of the scatter points). To prevent\n  this, be more explicit with the parameter types. For example, use <tt>QBrush(Qt::blue)</tt>\n  instead of just <tt>Qt::blue</tt>, to clearly point out to the compiler that this constructor is\n  wanted.\n*/\nQCPScatterStyle::QCPScatterStyle(ScatterShape shape, const QPen &pen, const QBrush &brush, double size) :\n  mSize(size),\n  mShape(shape),\n  mPen(pen),\n  mBrush(brush),\n  mPenDefined(pen.style() != Qt::NoPen)\n{\n}\n\n/*!\n  Creates a new QCPScatterStyle instance which will show the specified \\a pixmap. The scatter shape\n  is set to \\ref ssPixmap.\n*/\nQCPScatterStyle::QCPScatterStyle(const QPixmap &pixmap) :\n  mSize(5),\n  mShape(ssPixmap),\n  mPen(Qt::NoPen),\n  mBrush(Qt::NoBrush),\n  mPixmap(pixmap),\n  mPenDefined(false)\n{\n}\n\n/*!\n  Creates a new QCPScatterStyle instance with a custom shape that is defined via \\a customPath. The\n  scatter shape is set to \\ref ssCustom.\n  \n  The custom shape line will be drawn with \\a pen and filled with \\a brush. The size has a slightly\n  different meaning than for built-in scatter points: The custom path will be drawn scaled by a\n  factor of \\a size/6.0. Since the default \\a size is 6, the custom path will appear at a its\n  natural size by default. To double the size of the path for example, set \\a size to 12.\n*/\nQCPScatterStyle::QCPScatterStyle(const QPainterPath &customPath, const QPen &pen, const QBrush &brush, double size) :\n  mSize(size),\n  mShape(ssCustom),\n  mPen(pen),\n  mBrush(brush),\n  mCustomPath(customPath),\n  mPenDefined(false)\n{\n}\n\n/*!\n  Sets the size (pixel diameter) of the drawn scatter points to \\a size.\n  \n  \\see setShape\n*/\nvoid QCPScatterStyle::setSize(double size)\n{\n  mSize = size;\n}\n\n/*!\n  Sets the shape to \\a shape.\n  \n  Note that the calls \\ref setPixmap and \\ref setCustomPath automatically set the shape to \\ref\n  ssPixmap and \\ref ssCustom, respectively.\n  \n  \\see setSize\n*/\nvoid QCPScatterStyle::setShape(QCPScatterStyle::ScatterShape shape)\n{\n  mShape = shape;\n}\n\n/*!\n  Sets the pen that will be used to draw scatter points to \\a pen.\n  \n  If the pen was previously undefined (see \\ref isPenDefined), the pen is considered defined after\n  a call to this function, even if \\a pen is <tt>Qt::NoPen</tt>.\n  \n  \\see setBrush\n*/\nvoid QCPScatterStyle::setPen(const QPen &pen)\n{\n  mPenDefined = true;\n  mPen = pen;\n}\n\n/*!\n  Sets the brush that will be used to fill scatter points to \\a brush. Note that not all scatter\n  shapes have fillable areas. For example, \\ref ssPlus does not while \\ref ssCircle does.\n  \n  \\see setPen\n*/\nvoid QCPScatterStyle::setBrush(const QBrush &brush)\n{\n  mBrush = brush;\n}\n\n/*!\n  Sets the pixmap that will be drawn as scatter point to \\a pixmap.\n  \n  Note that \\ref setSize does not influence the appearance of the pixmap.\n  \n  The scatter shape is automatically set to \\ref ssPixmap.\n*/\nvoid QCPScatterStyle::setPixmap(const QPixmap &pixmap)\n{\n  setShape(ssPixmap);\n  mPixmap = pixmap;\n}\n\n/*!\n  Sets the custom shape that will be drawn as scatter point to \\a customPath.\n  \n  The scatter shape is automatically set to \\ref ssCustom.\n*/\nvoid QCPScatterStyle::setCustomPath(const QPainterPath &customPath)\n{\n  setShape(ssCustom);\n  mCustomPath = customPath;\n}\n\n/*!\n  Applies the pen and the brush of this scatter style to \\a painter. If this scatter style has an\n  undefined pen (\\ref isPenDefined), sets the pen of \\a painter to \\a defaultPen instead.\n  \n  This function is used by plottables (or any class that wants to draw scatters) just before a\n  number of scatters with this style shall be drawn with the \\a painter.\n  \n  \\see drawShape\n*/\nvoid QCPScatterStyle::applyTo(QCPPainter *painter, const QPen &defaultPen) const\n{\n  painter->setPen(mPenDefined ? mPen : defaultPen);\n  painter->setBrush(mBrush);\n}\n\n/*!\n  Draws the scatter shape with \\a painter at position \\a pos.\n  \n  This function does not modify the pen or the brush on the painter, as \\ref applyTo is meant to be\n  called before scatter points are drawn with \\ref drawShape.\n  \n  \\see applyTo\n*/\nvoid QCPScatterStyle::drawShape(QCPPainter *painter, QPointF pos) const\n{\n  drawShape(painter, pos.x(), pos.y());\n}\n\n/*! \\overload\n  Draws the scatter shape with \\a painter at position \\a x and \\a y.\n*/\nvoid QCPScatterStyle::drawShape(QCPPainter *painter, double x, double y) const\n{\n  double w = mSize/2.0;\n  switch (mShape)\n  {\n    case ssNone: break;\n    case ssDot:\n    {\n      painter->drawLine(QPointF(x, y), QPointF(x+0.0001, y));\n      break;\n    }\n    case ssCross:\n    {\n      painter->drawLine(QLineF(x-w, y-w, x+w, y+w));\n      painter->drawLine(QLineF(x-w, y+w, x+w, y-w));\n      break;\n    }\n    case ssPlus:\n    {\n      painter->drawLine(QLineF(x-w,   y, x+w,   y));\n      painter->drawLine(QLineF(  x, y+w,   x, y-w));\n      break;\n    }\n    case ssCircle:\n    {\n      painter->drawEllipse(QPointF(x , y), w, w);\n      break;\n    }\n    case ssDisc:\n    {\n      QBrush b = painter->brush();\n      painter->setBrush(painter->pen().color());\n      painter->drawEllipse(QPointF(x , y), w, w);\n      painter->setBrush(b);\n      break;\n    }\n    case ssSquare:\n    {\n      painter->drawRect(QRectF(x-w, y-w, mSize, mSize));\n      break;\n    }\n    case ssDiamond:\n    {\n      painter->drawLine(QLineF(x-w,   y,   x, y-w));\n      painter->drawLine(QLineF(  x, y-w, x+w,   y));\n      painter->drawLine(QLineF(x+w,   y,   x, y+w));\n      painter->drawLine(QLineF(  x, y+w, x-w,   y));\n      break;\n    }\n    case ssStar:\n    {\n      painter->drawLine(QLineF(x-w,   y, x+w,   y));\n      painter->drawLine(QLineF(  x, y+w,   x, y-w));\n      painter->drawLine(QLineF(x-w*0.707, y-w*0.707, x+w*0.707, y+w*0.707));\n      painter->drawLine(QLineF(x-w*0.707, y+w*0.707, x+w*0.707, y-w*0.707));\n      break;\n    }\n    case ssTriangle:\n    {\n       painter->drawLine(QLineF(x-w, y+0.755*w, x+w, y+0.755*w));\n       painter->drawLine(QLineF(x+w, y+0.755*w,   x, y-0.977*w));\n       painter->drawLine(QLineF(  x, y-0.977*w, x-w, y+0.755*w));\n      break;\n    }\n    case ssTriangleInverted:\n    {\n       painter->drawLine(QLineF(x-w, y-0.755*w, x+w, y-0.755*w));\n       painter->drawLine(QLineF(x+w, y-0.755*w,   x, y+0.977*w));\n       painter->drawLine(QLineF(  x, y+0.977*w, x-w, y-0.755*w));\n      break;\n    }\n    case ssCrossSquare:\n    {\n       painter->drawLine(QLineF(x-w, y-w, x+w*0.95, y+w*0.95));\n       painter->drawLine(QLineF(x-w, y+w*0.95, x+w*0.95, y-w));\n       painter->drawRect(QRectF(x-w, y-w, mSize, mSize));\n      break;\n    }\n    case ssPlusSquare:\n    {\n       painter->drawLine(QLineF(x-w,   y, x+w*0.95,   y));\n       painter->drawLine(QLineF(  x, y+w,        x, y-w));\n       painter->drawRect(QRectF(x-w, y-w, mSize, mSize));\n      break;\n    }\n    case ssCrossCircle:\n    {\n       painter->drawLine(QLineF(x-w*0.707, y-w*0.707, x+w*0.670, y+w*0.670));\n       painter->drawLine(QLineF(x-w*0.707, y+w*0.670, x+w*0.670, y-w*0.707));\n       painter->drawEllipse(QPointF(x, y), w, w);\n      break;\n    }\n    case ssPlusCircle:\n    {\n       painter->drawLine(QLineF(x-w,   y, x+w,   y));\n       painter->drawLine(QLineF(  x, y+w,   x, y-w));\n       painter->drawEllipse(QPointF(x, y), w, w);\n      break;\n    }\n    case ssPeace:\n    {\n       painter->drawLine(QLineF(x, y-w,         x,       y+w));\n       painter->drawLine(QLineF(x,   y, x-w*0.707, y+w*0.707));\n       painter->drawLine(QLineF(x,   y, x+w*0.707, y+w*0.707));\n       painter->drawEllipse(QPointF(x, y), w, w);\n      break;\n    }\n    case ssPixmap:\n    {\n      painter->drawPixmap(x-mPixmap.width()*0.5, y-mPixmap.height()*0.5, mPixmap);\n      break;\n    }\n    case ssCustom:\n    {\n      QTransform oldTransform = painter->transform();\n      painter->translate(x, y);\n      painter->scale(mSize/6.0, mSize/6.0);\n      painter->drawPath(mCustomPath);\n      painter->setTransform(oldTransform);\n      break;\n    }\n  }\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPLayer\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPLayer\n  \\brief A layer that may contain objects, to control the rendering order\n  \n  The Layering system of QCustomPlot is the mechanism to control the rendering order of the\n  elements inside the plot.\n  \n  It is based on the two classes QCPLayer and QCPLayerable. QCustomPlot holds an ordered list of\n  one or more instances of QCPLayer (see QCustomPlot::addLayer, QCustomPlot::layer,\n  QCustomPlot::moveLayer, etc.). When replotting, QCustomPlot goes through the list of layers\n  bottom to top and successively draws the layerables of the layers.\n  \n  A QCPLayer contains an ordered list of QCPLayerable instances. QCPLayerable is an abstract base\n  class from which almost all visible objects derive, like axes, grids, graphs, items, etc.\n  \n  Initially, QCustomPlot has five layers: \"background\", \"grid\", \"main\", \"axes\" and \"legend\" (in\n  that order). The top two layers \"axes\" and \"legend\" contain the default axes and legend, so they\n  will be drawn on top. In the middle, there is the \"main\" layer. It is initially empty and set as\n  the current layer (see QCustomPlot::setCurrentLayer). This means, all new plottables, items etc.\n  are created on this layer by default. Then comes the \"grid\" layer which contains the QCPGrid\n  instances (which belong tightly to QCPAxis, see \\ref QCPAxis::grid). The Axis rect background\n  shall be drawn behind everything else, thus the default QCPAxisRect instance is placed on the\n  \"background\" layer. Of course, the layer affiliation of the individual objects can be changed as\n  required (\\ref QCPLayerable::setLayer).\n  \n  Controlling the ordering of objects is easy: Create a new layer in the position you want it to\n  be, e.g. above \"main\", with QCustomPlot::addLayer. Then set the current layer with\n  QCustomPlot::setCurrentLayer to that new layer and finally create the objects normally. They will\n  be placed on the new layer automatically, due to the current layer setting. Alternatively you\n  could have also ignored the current layer setting and just moved the objects with\n  QCPLayerable::setLayer to the desired layer after creating them.\n  \n  It is also possible to move whole layers. For example, If you want the grid to be shown in front\n  of all plottables/items on the \"main\" layer, just move it above \"main\" with\n  QCustomPlot::moveLayer.\n  \n  The rendering order within one layer is simply by order of creation or insertion. The item\n  created last (or added last to the layer), is drawn on top of all other objects on that layer.\n  \n  When a layer is deleted, the objects on it are not deleted with it, but fall on the layer below\n  the deleted layer, see QCustomPlot::removeLayer.\n*/\n\n/* start documentation of inline functions */\n\n/*! \\fn QList<QCPLayerable*> QCPLayer::children() const\n  \n  Returns a list of all layerables on this layer. The order corresponds to the rendering order:\n  layerables with higher indices are drawn above layerables with lower indices.\n*/\n\n/*! \\fn int QCPLayer::index() const\n  \n  Returns the index this layer has in the QCustomPlot. The index is the integer number by which this layer can be\n  accessed via \\ref QCustomPlot::layer.\n  \n  Layers with higher indices will be drawn above layers with lower indices.\n*/\n\n/* end documentation of inline functions */\n\n/*!\n  Creates a new QCPLayer instance.\n  \n  Normally you shouldn't directly instantiate layers, use \\ref QCustomPlot::addLayer instead.\n  \n  \\warning It is not checked that \\a layerName is actually a unique layer name in \\a parentPlot.\n  This check is only performed by \\ref QCustomPlot::addLayer.\n*/\nQCPLayer::QCPLayer(QCustomPlot *parentPlot, const QString &layerName) :\n  QObject(parentPlot),\n  mParentPlot(parentPlot),\n  mName(layerName),\n  mIndex(-1), // will be set to a proper value by the QCustomPlot layer creation function\n  mVisible(true)\n{\n  // Note: no need to make sure layerName is unique, because layer\n  // management is done with QCustomPlot functions.\n}\n\nQCPLayer::~QCPLayer()\n{\n  // If child layerables are still on this layer, detach them, so they don't try to reach back to this\n  // then invalid layer once they get deleted/moved themselves. This only happens when layers are deleted\n  // directly, like in the QCustomPlot destructor. (The regular layer removal procedure for the user is to\n  // call QCustomPlot::removeLayer, which moves all layerables off this layer before deleting it.)\n  \n  while (!mChildren.isEmpty())\n    mChildren.last()->setLayer(0); // removes itself from mChildren via removeChild()\n  \n  if (mParentPlot->currentLayer() == this)\n    qDebug() << Q_FUNC_INFO << \"The parent plot's mCurrentLayer will be a dangling pointer. Should have been set to a valid layer or 0 beforehand.\";\n}\n\n/*!\n  Sets whether this layer is visible or not. If \\a visible is set to false, all layerables on this\n  layer will be invisible.\n\n  This function doesn't change the visibility property of the layerables (\\ref\n  QCPLayerable::setVisible), but the \\ref QCPLayerable::realVisibility of each layerable takes the\n  visibility of the parent layer into account.\n*/\nvoid QCPLayer::setVisible(bool visible)\n{\n  mVisible = visible;\n}\n\n/*! \\internal\n  \n  Adds the \\a layerable to the list of this layer. If \\a prepend is set to true, the layerable will\n  be prepended to the list, i.e. be drawn beneath the other layerables already in the list.\n  \n  This function does not change the \\a mLayer member of \\a layerable to this layer. (Use\n  QCPLayerable::setLayer to change the layer of an object, not this function.)\n  \n  \\see removeChild\n*/\nvoid QCPLayer::addChild(QCPLayerable *layerable, bool prepend)\n{\n  if (!mChildren.contains(layerable))\n  {\n    if (prepend)\n      mChildren.prepend(layerable);\n    else\n      mChildren.append(layerable);\n  } else\n    qDebug() << Q_FUNC_INFO << \"layerable is already child of this layer\" << reinterpret_cast<quintptr>(layerable);\n}\n\n/*! \\internal\n  \n  Removes the \\a layerable from the list of this layer.\n  \n  This function does not change the \\a mLayer member of \\a layerable. (Use QCPLayerable::setLayer\n  to change the layer of an object, not this function.)\n  \n  \\see addChild\n*/\nvoid QCPLayer::removeChild(QCPLayerable *layerable)\n{\n  if (!mChildren.removeOne(layerable))\n    qDebug() << Q_FUNC_INFO << \"layerable is not child of this layer\" << reinterpret_cast<quintptr>(layerable);\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPLayerable\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPLayerable\n  \\brief Base class for all drawable objects\n  \n  This is the abstract base class most visible objects derive from, e.g. plottables, axes, grid\n  etc.\n\n  Every layerable is on a layer (QCPLayer) which allows controlling the rendering order by stacking\n  the layers accordingly.\n  \n  For details about the layering mechanism, see the QCPLayer documentation.\n*/\n\n/* start documentation of inline functions */\n\n/*! \\fn QCPLayerable *QCPLayerable::parentLayerable() const\n \n  Returns the parent layerable of this layerable. The parent layerable is used to provide\n  visibility hierarchies in conjunction with the method \\ref realVisibility. This way, layerables\n  only get drawn if their parent layerables are visible, too.\n  \n  Note that a parent layerable is not necessarily also the QObject parent for memory management.\n  Further, a layerable doesn't always have a parent layerable, so this function may return 0.\n  \n  A parent layerable is set implicitly with when placed inside layout elements and doesn't need to be\n  set manually by the user.\n*/\n\n/* end documentation of inline functions */\n/* start documentation of pure virtual functions */\n\n/*! \\fn virtual void QCPLayerable::applyDefaultAntialiasingHint(QCPPainter *painter) const = 0\n  \\internal\n  \n  This function applies the default antialiasing setting to the specified \\a painter, using the\n  function \\ref applyAntialiasingHint. It is the antialiasing state the painter is put in, when\n  \\ref draw is called on the layerable. If the layerable has multiple entities whose antialiasing\n  setting may be specified individually, this function should set the antialiasing state of the\n  most prominent entity. In this case however, the \\ref draw function usually calls the specialized\n  versions of this function before drawing each entity, effectively overriding the setting of the\n  default antialiasing hint.\n  \n  <b>First example:</b> QCPGraph has multiple entities that have an antialiasing setting: The graph\n  line, fills, scatters and error bars. Those can be configured via QCPGraph::setAntialiased,\n  QCPGraph::setAntialiasedFill, QCPGraph::setAntialiasedScatters etc. Consequently, there isn't\n  only the QCPGraph::applyDefaultAntialiasingHint function (which corresponds to the graph line's\n  antialiasing), but specialized ones like QCPGraph::applyFillAntialiasingHint and\n  QCPGraph::applyScattersAntialiasingHint. So before drawing one of those entities, QCPGraph::draw\n  calls the respective specialized applyAntialiasingHint function.\n  \n  <b>Second example:</b> QCPItemLine consists only of a line so there is only one antialiasing\n  setting which can be controlled with QCPItemLine::setAntialiased. (This function is inherited by\n  all layerables. The specialized functions, as seen on QCPGraph, must be added explicitly to the\n  respective layerable subclass.) Consequently it only has the normal\n  QCPItemLine::applyDefaultAntialiasingHint. The \\ref QCPItemLine::draw function doesn't need to\n  care about setting any antialiasing states, because the default antialiasing hint is already set\n  on the painter when the \\ref draw function is called, and that's the state it wants to draw the\n  line with.\n*/\n\n/*! \\fn virtual void QCPLayerable::draw(QCPPainter *painter) const = 0\n  \\internal\n  \n  This function draws the layerable with the specified \\a painter. It is only called by\n  QCustomPlot, if the layerable is visible (\\ref setVisible).\n  \n  Before this function is called, the painter's antialiasing state is set via \\ref\n  applyDefaultAntialiasingHint, see the documentation there. Further, the clipping rectangle was\n  set to \\ref clipRect.\n*/\n\n/* end documentation of pure virtual functions */\n/* start documentation of signals */\n\n/*! \\fn void QCPLayerable::layerChanged(QCPLayer *newLayer);\n  \n  This signal is emitted when the layer of this layerable changes, i.e. this layerable is moved to\n  a different layer.\n  \n  \\see setLayer\n*/\n\n/* end documentation of signals */\n\n/*!\n  Creates a new QCPLayerable instance.\n  \n  Since QCPLayerable is an abstract base class, it can't be instantiated directly. Use one of the\n  derived classes.\n  \n  If \\a plot is provided, it automatically places itself on the layer named \\a targetLayer. If \\a\n  targetLayer is an empty string, it places itself on the current layer of the plot (see \\ref\n  QCustomPlot::setCurrentLayer).\n  \n  It is possible to provide 0 as \\a plot. In that case, you should assign a parent plot at a later\n  time with \\ref initializeParentPlot.\n  \n  The layerable's parent layerable is set to \\a parentLayerable, if provided. Direct layerable parents\n  are mainly used to control visibility in a hierarchy of layerables. This means a layerable is\n  only drawn, if all its ancestor layerables are also visible. Note that \\a parentLayerable does\n  not become the QObject-parent (for memory management) of this layerable, \\a plot does.\n*/\nQCPLayerable::QCPLayerable(QCustomPlot *plot, QString targetLayer, QCPLayerable *parentLayerable) :\n  QObject(plot),\n  mVisible(true),\n  mParentPlot(plot),\n  mParentLayerable(parentLayerable),\n  mLayer(0),\n  mAntialiased(true)\n{\n  if (mParentPlot)\n  {\n    if (targetLayer.isEmpty())\n      setLayer(mParentPlot->currentLayer());\n    else if (!setLayer(targetLayer))\n      qDebug() << Q_FUNC_INFO << \"setting QCPlayerable initial layer to\" << targetLayer << \"failed.\";\n  }\n}\n\nQCPLayerable::~QCPLayerable()\n{\n  if (mLayer)\n  {\n    mLayer->removeChild(this);\n    mLayer = 0;\n  }\n}\n\n/*!\n  Sets the visibility of this layerable object. If an object is not visible, it will not be drawn\n  on the QCustomPlot surface, and user interaction with it (e.g. click and selection) is not\n  possible.\n*/\nvoid QCPLayerable::setVisible(bool on)\n{\n  mVisible = on;\n}\n\n/*!\n  Sets the \\a layer of this layerable object. The object will be placed on top of the other objects\n  already on \\a layer.\n  \n  Returns true on success, i.e. if \\a layer is a valid layer.\n*/\nbool QCPLayerable::setLayer(QCPLayer *layer)\n{\n  return moveToLayer(layer, false);\n}\n\n/*! \\overload\n  Sets the layer of this layerable object by name\n  \n  Returns true on success, i.e. if \\a layerName is a valid layer name.\n*/\nbool QCPLayerable::setLayer(const QString &layerName)\n{\n  if (!mParentPlot)\n  {\n    qDebug() << Q_FUNC_INFO << \"no parent QCustomPlot set\";\n    return false;\n  }\n  if (QCPLayer *layer = mParentPlot->layer(layerName))\n  {\n    return setLayer(layer);\n  } else\n  {\n    qDebug() << Q_FUNC_INFO << \"there is no layer with name\" << layerName;\n    return false;\n  }\n}\n\n/*!\n  Sets whether this object will be drawn antialiased or not.\n  \n  Note that antialiasing settings may be overridden by QCustomPlot::setAntialiasedElements and\n  QCustomPlot::setNotAntialiasedElements.\n*/\nvoid QCPLayerable::setAntialiased(bool enabled)\n{\n  mAntialiased = enabled;\n}\n\n/*!\n  Returns whether this layerable is visible, taking the visibility of the layerable parent and the\n  visibility of the layer this layerable is on into account. This is the method that is consulted\n  to decide whether a layerable shall be drawn or not.\n  \n  If this layerable has a direct layerable parent (usually set via hierarchies implemented in\n  subclasses, like in the case of QCPLayoutElement), this function returns true only if this\n  layerable has its visibility set to true and the parent layerable's \\ref realVisibility returns\n  true.\n  \n  If this layerable doesn't have a direct layerable parent, returns the state of this layerable's\n  visibility.\n*/\nbool QCPLayerable::realVisibility() const\n{\n  return mVisible && (!mLayer || mLayer->visible()) && (!mParentLayerable || mParentLayerable.data()->realVisibility());\n}\n\n/*!\n  This function is used to decide whether a click hits a layerable object or not.\n\n  \\a pos is a point in pixel coordinates on the QCustomPlot surface. This function returns the\n  shortest pixel distance of this point to the object. If the object is either invisible or the\n  distance couldn't be determined, -1.0 is returned. Further, if \\a onlySelectable is true and the\n  object is not selectable, -1.0 is returned, too.\n\n  If the item is represented not by single lines but by an area like QCPItemRect or QCPItemText, a\n  click inside the area returns a constant value greater zero (typically the selectionTolerance of\n  the parent QCustomPlot multiplied by 0.99). If the click lies outside the area, this function\n  returns -1.0.\n  \n  Providing a constant value for area objects allows selecting line objects even when they are\n  obscured by such area objects, by clicking close to the lines (i.e. closer than\n  0.99*selectionTolerance).\n  \n  The actual setting of the selection state is not done by this function. This is handled by the\n  parent QCustomPlot when the mouseReleaseEvent occurs, and the finally selected object is notified\n  via the selectEvent/deselectEvent methods.\n  \n  \\a details is an optional output parameter. Every layerable subclass may place any information\n  in \\a details. This information will be passed to \\ref selectEvent when the parent QCustomPlot\n  decides on the basis of this selectTest call, that the object was successfully selected. The\n  subsequent call to \\ref selectEvent will carry the \\a details. This is useful for multi-part\n  objects (like QCPAxis). This way, a possibly complex calculation to decide which part was clicked\n  is only done once in \\ref selectTest. The result (i.e. the actually clicked part) can then be\n  placed in \\a details. So in the subsequent \\ref selectEvent, the decision which part was\n  selected doesn't have to be done a second time for a single selection operation.\n  \n  You may pass 0 as \\a details to indicate that you are not interested in those selection details.\n  \n  \\see selectEvent, deselectEvent, QCustomPlot::setInteractions\n*/\ndouble QCPLayerable::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const\n{\n  Q_UNUSED(pos)\n  Q_UNUSED(onlySelectable)\n  Q_UNUSED(details)\n  return -1.0;\n}\n\n/*! \\internal\n  \n  Sets the parent plot of this layerable. Use this function once to set the parent plot if you have\n  passed 0 in the constructor. It can not be used to move a layerable from one QCustomPlot to\n  another one.\n  \n  Note that, unlike when passing a non-null parent plot in the constructor, this function does not\n  make \\a parentPlot the QObject-parent of this layerable. If you want this, call\n  QObject::setParent(\\a parentPlot) in addition to this function.\n  \n  Further, you will probably want to set a layer (\\ref setLayer) after calling this function, to\n  make the layerable appear on the QCustomPlot.\n  \n  The parent plot change will be propagated to subclasses via a call to \\ref parentPlotInitialized\n  so they can react accordingly (e.g. also initialize the parent plot of child layerables, like\n  QCPLayout does).\n*/\nvoid QCPLayerable::initializeParentPlot(QCustomPlot *parentPlot)\n{\n  if (mParentPlot)\n  {\n    qDebug() << Q_FUNC_INFO << \"called with mParentPlot already initialized\";\n    return;\n  }\n  \n  if (!parentPlot)\n    qDebug() << Q_FUNC_INFO << \"called with parentPlot zero\";\n  \n  mParentPlot = parentPlot;\n  parentPlotInitialized(mParentPlot);\n}\n\n/*! \\internal\n  \n  Sets the parent layerable of this layerable to \\a parentLayerable. Note that \\a parentLayerable does not\n  become the QObject-parent (for memory management) of this layerable.\n  \n  The parent layerable has influence on the return value of the \\ref realVisibility method. Only\n  layerables with a fully visible parent tree will return true for \\ref realVisibility, and thus be\n  drawn.\n  \n  \\see realVisibility\n*/\nvoid QCPLayerable::setParentLayerable(QCPLayerable *parentLayerable)\n{\n  mParentLayerable = parentLayerable;\n}\n\n/*! \\internal\n  \n  Moves this layerable object to \\a layer. If \\a prepend is true, this object will be prepended to\n  the new layer's list, i.e. it will be drawn below the objects already on the layer. If it is\n  false, the object will be appended.\n  \n  Returns true on success, i.e. if \\a layer is a valid layer.\n*/\nbool QCPLayerable::moveToLayer(QCPLayer *layer, bool prepend)\n{\n  if (layer && !mParentPlot)\n  {\n    qDebug() << Q_FUNC_INFO << \"no parent QCustomPlot set\";\n    return false;\n  }\n  if (layer && layer->parentPlot() != mParentPlot)\n  {\n    qDebug() << Q_FUNC_INFO << \"layer\" << layer->name() << \"is not in same QCustomPlot as this layerable\";\n    return false;\n  }\n  \n  QCPLayer *oldLayer = mLayer;\n  if (mLayer)\n    mLayer->removeChild(this);\n  mLayer = layer;\n  if (mLayer)\n    mLayer->addChild(this, prepend);\n  if (mLayer != oldLayer)\n    emit layerChanged(mLayer);\n  return true;\n}\n\n/*! \\internal\n\n  Sets the QCPainter::setAntialiasing state on the provided \\a painter, depending on the \\a\n  localAntialiased value as well as the overrides \\ref QCustomPlot::setAntialiasedElements and \\ref\n  QCustomPlot::setNotAntialiasedElements. Which override enum this function takes into account is\n  controlled via \\a overrideElement.\n*/\nvoid QCPLayerable::applyAntialiasingHint(QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const\n{\n  if (mParentPlot && mParentPlot->notAntialiasedElements().testFlag(overrideElement))\n    painter->setAntialiasing(false);\n  else if (mParentPlot && mParentPlot->antialiasedElements().testFlag(overrideElement))\n    painter->setAntialiasing(true);\n  else\n    painter->setAntialiasing(localAntialiased);\n}\n\n/*! \\internal\n\n  This function is called by \\ref initializeParentPlot, to allow subclasses to react on the setting\n  of a parent plot. This is the case when 0 was passed as parent plot in the constructor, and the\n  parent plot is set at a later time.\n  \n  For example, QCPLayoutElement/QCPLayout hierarchies may be created independently of any\n  QCustomPlot at first. When they are then added to a layout inside the QCustomPlot, the top level\n  element of the hierarchy gets its parent plot initialized with \\ref initializeParentPlot. To\n  propagate the parent plot to all the children of the hierarchy, the top level element then uses\n  this function to pass the parent plot on to its child elements.\n  \n  The default implementation does nothing.\n  \n  \\see initializeParentPlot\n*/\nvoid QCPLayerable::parentPlotInitialized(QCustomPlot *parentPlot)\n{\n   Q_UNUSED(parentPlot)\n}\n\n/*! \\internal\n\n  Returns the selection category this layerable shall belong to. The selection category is used in\n  conjunction with \\ref QCustomPlot::setInteractions to control which objects are selectable and\n  which aren't.\n  \n  Subclasses that don't fit any of the normal \\ref QCP::Interaction values can use \\ref\n  QCP::iSelectOther. This is what the default implementation returns.\n  \n  \\see QCustomPlot::setInteractions\n*/\nQCP::Interaction QCPLayerable::selectionCategory() const\n{\n  return QCP::iSelectOther;\n}\n\n/*! \\internal\n  \n  Returns the clipping rectangle of this layerable object. By default, this is the viewport of the\n  parent QCustomPlot. Specific subclasses may reimplement this function to provide different\n  clipping rects.\n  \n  The returned clipping rect is set on the painter before the draw function of the respective\n  object is called.\n*/\nQRect QCPLayerable::clipRect() const\n{\n  if (mParentPlot)\n    return mParentPlot->viewport();\n  else\n    return QRect();\n}\n\n/*! \\internal\n  \n  This event is called when the layerable shall be selected, as a consequence of a click by the\n  user. Subclasses should react to it by setting their selection state appropriately. The default\n  implementation does nothing.\n  \n  \\a event is the mouse event that caused the selection. \\a additive indicates, whether the user\n  was holding the multi-select-modifier while performing the selection (see \\ref\n  QCustomPlot::setMultiSelectModifier). if \\a additive is true, the selection state must be toggled\n  (i.e. become selected when unselected and unselected when selected).\n  \n  Every selectEvent is preceded by a call to \\ref selectTest, which has returned positively (i.e.\n  returned a value greater than 0 and less than the selection tolerance of the parent QCustomPlot).\n  The \\a details data you output from \\ref selectTest is fed back via \\a details here. You may\n  use it to transport any kind of information from the selectTest to the possibly subsequent\n  selectEvent. Usually \\a details is used to transfer which part was clicked, if it is a layerable\n  that has multiple individually selectable parts (like QCPAxis). This way selectEvent doesn't need\n  to do the calculation again to find out which part was actually clicked.\n  \n  \\a selectionStateChanged is an output parameter. If the pointer is non-null, this function must\n  set the value either to true or false, depending on whether the selection state of this layerable\n  was actually changed. For layerables that only are selectable as a whole and not in parts, this\n  is simple: if \\a additive is true, \\a selectionStateChanged must also be set to true, because the\n  selection toggles. If \\a additive is false, \\a selectionStateChanged is only set to true, if the\n  layerable was previously unselected and now is switched to the selected state.\n  \n  \\see selectTest, deselectEvent\n*/\nvoid QCPLayerable::selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)\n{\n  Q_UNUSED(event)\n  Q_UNUSED(additive)\n  Q_UNUSED(details)\n  Q_UNUSED(selectionStateChanged)\n}\n\n/*! \\internal\n  \n  This event is called when the layerable shall be deselected, either as consequence of a user\n  interaction or a call to \\ref QCustomPlot::deselectAll. Subclasses should react to it by\n  unsetting their selection appropriately.\n  \n  just as in \\ref selectEvent, the output parameter \\a selectionStateChanged (if non-null), must\n  return true or false when the selection state of this layerable has changed or not changed,\n  respectively.\n  \n  \\see selectTest, selectEvent\n*/\nvoid QCPLayerable::deselectEvent(bool *selectionStateChanged)\n{\n  Q_UNUSED(selectionStateChanged)\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPRange\n////////////////////////////////////////////////////////////////////////////////////////////////////\n/*! \\class QCPRange\n  \\brief Represents the range an axis is encompassing.\n  \n  contains a \\a lower and \\a upper double value and provides convenience input, output and\n  modification functions.\n  \n  \\see QCPAxis::setRange\n*/\n\n/*!\n  Minimum range size (\\a upper - \\a lower) the range changing functions will accept. Smaller\n  intervals would cause errors due to the 11-bit exponent of double precision numbers,\n  corresponding to a minimum magnitude of roughly 1e-308.\n  \\see validRange, maxRange\n*/\nconst double QCPRange::minRange = 1e-280;\n\n/*!\n  Maximum values (negative and positive) the range will accept in range-changing functions.\n  Larger absolute values would cause errors due to the 11-bit exponent of double precision numbers,\n  corresponding to a maximum magnitude of roughly 1e308.\n  Since the number of planck-volumes in the entire visible universe is only ~1e183, this should\n  be enough.\n  \\see validRange, minRange\n*/\nconst double QCPRange::maxRange = 1e250;\n\n/*!\n  Constructs a range with \\a lower and \\a upper set to zero.\n*/\nQCPRange::QCPRange() :\n  lower(0),\n  upper(0)\n{\n}\n\n/*! \\overload\n  Constructs a range with the specified \\a lower and \\a upper values.\n*/\nQCPRange::QCPRange(double lower, double upper) :\n  lower(lower),\n  upper(upper)\n{\n  normalize();\n}\n\n/*!\n  Returns the size of the range, i.e. \\a upper-\\a lower\n*/\ndouble QCPRange::size() const\n{\n  return upper-lower;\n}\n\n/*!\n  Returns the center of the range, i.e. (\\a upper+\\a lower)*0.5\n*/\ndouble QCPRange::center() const\n{\n  return (upper+lower)*0.5;\n}\n\n/*!\n  Makes sure \\a lower is numerically smaller than \\a upper. If this is not the case, the values\n  are swapped.\n*/\nvoid QCPRange::normalize()\n{\n  if (lower > upper)\n    qSwap(lower, upper);\n}\n\n/*!\n  Expands this range such that \\a otherRange is contained in the new range. It is assumed that both\n  this range and \\a otherRange are normalized (see \\ref normalize).\n  \n  If \\a otherRange is already inside the current range, this function does nothing.\n  \n  \\see expanded\n*/\nvoid QCPRange::expand(const QCPRange &otherRange)\n{\n  if (lower > otherRange.lower)\n    lower = otherRange.lower;\n  if (upper < otherRange.upper)\n    upper = otherRange.upper;\n}\n\n\n/*!\n  Returns an expanded range that contains this and \\a otherRange. It is assumed that both this\n  range and \\a otherRange are normalized (see \\ref normalize).\n  \n  \\see expand\n*/\nQCPRange QCPRange::expanded(const QCPRange &otherRange) const\n{\n  QCPRange result = *this;\n  result.expand(otherRange);\n  return result;\n}\n\n/*!\n  Returns a sanitized version of the range. Sanitized means for logarithmic scales, that\n  the range won't span the positive and negative sign domain, i.e. contain zero. Further\n  \\a lower will always be numerically smaller (or equal) to \\a upper.\n  \n  If the original range does span positive and negative sign domains or contains zero,\n  the returned range will try to approximate the original range as good as possible.\n  If the positive interval of the original range is wider than the negative interval, the\n  returned range will only contain the positive interval, with lower bound set to \\a rangeFac or\n  \\a rangeFac *\\a upper, whichever is closer to zero. Same procedure is used if the negative interval\n  is wider than the positive interval, this time by changing the \\a upper bound.\n*/\nQCPRange QCPRange::sanitizedForLogScale() const\n{\n  double rangeFac = 1e-3;\n  QCPRange sanitizedRange(lower, upper);\n  sanitizedRange.normalize();\n  // can't have range spanning negative and positive values in log plot, so change range to fix it\n  //if (qFuzzyCompare(sanitizedRange.lower+1, 1) && !qFuzzyCompare(sanitizedRange.upper+1, 1))\n  if (sanitizedRange.lower == 0.0 && sanitizedRange.upper != 0.0)\n  {\n    // case lower is 0\n    if (rangeFac < sanitizedRange.upper*rangeFac)\n      sanitizedRange.lower = rangeFac;\n    else\n      sanitizedRange.lower = sanitizedRange.upper*rangeFac;\n  } //else if (!qFuzzyCompare(lower+1, 1) && qFuzzyCompare(upper+1, 1))\n  else if (sanitizedRange.lower != 0.0 && sanitizedRange.upper == 0.0)\n  {\n    // case upper is 0\n    if (-rangeFac > sanitizedRange.lower*rangeFac)\n      sanitizedRange.upper = -rangeFac;\n    else\n      sanitizedRange.upper = sanitizedRange.lower*rangeFac;\n  } else if (sanitizedRange.lower < 0 && sanitizedRange.upper > 0)\n  {\n    // find out whether negative or positive interval is wider to decide which sign domain will be chosen\n    if (-sanitizedRange.lower > sanitizedRange.upper)\n    {\n      // negative is wider, do same as in case upper is 0\n      if (-rangeFac > sanitizedRange.lower*rangeFac)\n        sanitizedRange.upper = -rangeFac;\n      else\n        sanitizedRange.upper = sanitizedRange.lower*rangeFac;\n    } else\n    {\n      // positive is wider, do same as in case lower is 0\n      if (rangeFac < sanitizedRange.upper*rangeFac)\n        sanitizedRange.lower = rangeFac;\n      else\n        sanitizedRange.lower = sanitizedRange.upper*rangeFac;\n    }\n  }\n  // due to normalization, case lower>0 && upper<0 should never occur, because that implies upper<lower\n  return sanitizedRange;\n}\n\n/*!\n  Returns a sanitized version of the range. Sanitized means for linear scales, that\n  \\a lower will always be numerically smaller (or equal) to \\a upper.\n*/\nQCPRange QCPRange::sanitizedForLinScale() const\n{\n  QCPRange sanitizedRange(lower, upper);\n  sanitizedRange.normalize();\n  return sanitizedRange;\n}\n\n/*!\n  Returns true when \\a value lies within or exactly on the borders of the range.\n*/\nbool QCPRange::contains(double value) const\n{\n  return value >= lower && value <= upper;\n}\n\n/*!\n  Checks, whether the specified range is within valid bounds, which are defined\n  as QCPRange::maxRange and QCPRange::minRange.\n  A valid range means:\n  \\li range bounds within -maxRange and maxRange\n  \\li range size above minRange\n  \\li range size below maxRange\n*/\nbool QCPRange::validRange(double lower, double upper)\n{\n  /*\n  return (lower > -maxRange &&\n          upper < maxRange &&\n          qAbs(lower-upper) > minRange &&\n          (lower < -minRange || lower > minRange) &&\n          (upper < -minRange || upper > minRange));\n          */\n  return (lower > -maxRange &&\n          upper < maxRange &&\n          qAbs(lower-upper) > minRange &&\n          qAbs(lower-upper) < maxRange);\n}\n\n/*!\n  \\overload\n  Checks, whether the specified range is within valid bounds, which are defined\n  as QCPRange::maxRange and QCPRange::minRange.\n  A valid range means:\n  \\li range bounds within -maxRange and maxRange\n  \\li range size above minRange\n  \\li range size below maxRange\n*/\nbool QCPRange::validRange(const QCPRange &range)\n{\n  /*\n  return (range.lower > -maxRange &&\n          range.upper < maxRange &&\n          qAbs(range.lower-range.upper) > minRange &&\n          qAbs(range.lower-range.upper) < maxRange &&\n          (range.lower < -minRange || range.lower > minRange) &&\n          (range.upper < -minRange || range.upper > minRange));\n          */\n  return (range.lower > -maxRange &&\n          range.upper < maxRange &&\n          qAbs(range.lower-range.upper) > minRange &&\n          qAbs(range.lower-range.upper) < maxRange);\n}\n\n\n/*! \\page thelayoutsystem The Layout System\n \n  The layout system is responsible for positioning and scaling layout elements such as axis rects,\n  legends and plot titles in a QCustomPlot.\n\n  \\section layoutsystem-classesandmechanisms Classes and mechanisms\n  \n  The layout system is based on the abstract base class \\ref QCPLayoutElement. All objects that\n  take part in the layout system derive from this class, either directly or indirectly.\n  \n  Since QCPLayoutElement itself derives from \\ref QCPLayerable, a layout element may draw its own\n  content. However, it is perfectly possible for a layout element to only serve as a structuring\n  and/or positioning element, not drawing anything on its own.\n  \n  \\subsection layoutsystem-rects Rects of a layout element\n  \n  A layout element is a rectangular object described by two rects: the inner rect (\\ref\n  QCPLayoutElement::rect) and the outer rect (\\ref QCPLayoutElement::setOuterRect). The inner rect\n  is calculated automatically by applying the margin (\\ref QCPLayoutElement::setMargins) inward\n  from the outer rect. The inner rect is meant for main content while the margin area may either be\n  left blank or serve for displaying peripheral graphics. For example, \\ref QCPAxisRect positions\n  the four main axes at the sides of the inner rect, so graphs end up inside it and the axis labels\n  and tick labels are in the margin area.\n  \n  \\subsection layoutsystem-margins Margins\n  \n  Each layout element may provide a mechanism to automatically determine its margins. Internally,\n  this is realized with the \\ref QCPLayoutElement::calculateAutoMargin function which takes a \\ref\n  QCP::MarginSide and returns an integer value which represents the ideal margin for the specified\n  side. The automatic margin will be used on the sides specified in \\ref\n  QCPLayoutElement::setAutoMargins. By default, it is set to \\ref QCP::msAll meaning automatic\n  margin calculation is enabled for all four sides. In this case, a minimum margin may be set with\n  \\ref QCPLayoutElement::setMinimumMargins, to prevent the automatic margin mechanism from setting\n  margins smaller than desired for a specific situation. If automatic margin calculation is unset\n  for a specific side, the margin of that side can be controlled directy via \\ref\n  QCPLayoutElement::setMargins.\n  \n  If multiple layout ements are arranged next to or beneath each other, it may be desirable to\n  align their inner rects on certain sides. Since they all might have different automatic margins,\n  this usually isn't the case. The class \\ref QCPMarginGroup and \\ref\n  QCPLayoutElement::setMarginGroup fix this by allowing to synchronize multiple margins. See the\n  documentation there for details.\n  \n  \\subsection layoutsystem-layout Layouts\n  \n  As mentioned, a QCPLayoutElement may have an arbitrary number of child layout elements and in\n  princple can have the only purpose to manage/arrange those child elements. This is what the\n  subclass \\ref QCPLayout specializes on. It is a QCPLayoutElement itself but has no visual\n  representation. It defines an interface to add, remove and manage child layout elements.\n  QCPLayout isn't a usable layout though, it's an abstract base class that concrete layouts derive\n  from, like \\ref QCPLayoutGrid which arranges its child elements in a grid and \\ref QCPLayoutInset\n  which allows placing child elements freely inside its rect.\n  \n  Since a QCPLayout is a layout element itself, it may be placed inside other layouts. This way,\n  complex hierarchies may be created, offering very flexible arrangements.\n  \n  \\image html LayoutsystemSketch.png \n  \n  Above is a sketch of the default \\ref QCPLayoutGrid accessible via \\ref QCustomPlot::plotLayout.\n  It shows how two child layout elements are placed inside the grid layout next to each other in\n  cells (0, 0) and (0, 1).\n  \n  \\subsection layoutsystem-plotlayout The top level plot layout\n  \n  Every QCustomPlot has one top level layout of type \\ref QCPLayoutGrid. It is accessible via \\ref\n  QCustomPlot::plotLayout and contains (directly or indirectly via other sub-layouts) all layout\n  elements in the QCustomPlot. By default, this top level grid layout contains a single cell which\n  holds the main axis rect.\n \n  \\subsection layoutsystem-examples Examples\n  \n  <b>Adding a plot title</b> is a typical and simple case to demonstrate basic workings of the layout system.\n  \\code\n  // first we create and prepare a plot title layout element:\n  QCPPlotTitle *title = new QCPPlotTitle(customPlot);\n  title->setText(\"Plot Title Example\");\n  title->setFont(QFont(\"sans\", 12, QFont::Bold));\n  // then we add it to the main plot layout:\n  customPlot->plotLayout()->insertRow(0); // insert an empty row above the axis rect\n  customPlot->plotLayout()->addElement(0, 0, title); // place the title in the empty cell we've just created\n  \\endcode\n  \\image html layoutsystem-addingplottitle.png\n\n  <b>Arranging multiple axis rects</b> actually is the central purpose of the layout system.\n  \\code\n  customPlot->plotLayout()->clear(); // let's start from scratch and remove the default axis rect\n  // add the first axis rect in second row (row index 1):\n  QCPAxisRect *topAxisRect = new QCPAxisRect(customPlot);\n  customPlot->plotLayout()->addElement(1, 0, topAxisRect);\n  // create a sub layout that we'll place in first row:\n  QCPLayoutGrid *subLayout = new QCPLayoutGrid;\n  customPlot->plotLayout()->addElement(0, 0, subLayout);\n  // add two axis rects in the sub layout next to each other:\n  QCPAxisRect *leftAxisRect = new QCPAxisRect(customPlot);\n  QCPAxisRect *rightAxisRect = new QCPAxisRect(customPlot);\n  subLayout->addElement(0, 0, leftAxisRect);\n  subLayout->addElement(0, 1, rightAxisRect);\n  subLayout->setColumnStretchFactor(0, 3); // left axis rect shall have 60% of width\n  subLayout->setColumnStretchFactor(1, 2); // right one only 40% (3:2 = 60:40)\n  // since we've created the axis rects and axes from scratch, we need to place them on\n  // according layers, if we don't want the grid to be drawn above the axes etc.\n  // place the axis on \"axes\" layer and grids on the \"grid\" layer, which is below \"axes\":\n  QList<QCPAxis*> allAxes;\n  allAxes << topAxisRect->axes() << leftAxisRect->axes() << rightAxisRect->axes();\n  foreach (QCPAxis *axis, allAxes)\n  {\n    axis->setLayer(\"axes\");\n    axis->grid()->setLayer(\"grid\");\n  }\n  \\endcode\n  \\image html layoutsystem-multipleaxisrects.png\n  \n*/\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPMarginGroup\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPMarginGroup\n  \\brief A margin group allows synchronization of margin sides if working with multiple layout elements.\n  \n  QCPMarginGroup allows you to tie a margin side of two or more layout elements together, such that\n  they will all have the same size, based on the largest required margin in the group.\n  \n  \\n\n  \\image html QCPMarginGroup.png \"Demonstration of QCPMarginGroup\"\n  \\n\n  \n  In certain situations it is desirable that margins at specific sides are synchronized across\n  layout elements. For example, if one QCPAxisRect is below another one in a grid layout, it will\n  provide a cleaner look to the user if the left and right margins of the two axis rects are of the\n  same size. The left axis of the top axis rect will then be at the same horizontal position as the\n  left axis of the lower axis rect, making them appear aligned. The same applies for the right\n  axes. This is what QCPMarginGroup makes possible.\n  \n  To add/remove a specific side of a layout element to/from a margin group, use the \\ref\n  QCPLayoutElement::setMarginGroup method. To completely break apart the margin group, either call\n  \\ref clear, or just delete the margin group.\n  \n  \\section QCPMarginGroup-example Example\n  \n  First create a margin group:\n  \\code\n  QCPMarginGroup *group = new QCPMarginGroup(customPlot);\n  \\endcode\n  Then set this group on the layout element sides:\n  \\code\n  customPlot->axisRect(0)->setMarginGroup(QCP::msLeft|QCP::msRight, group);\n  customPlot->axisRect(1)->setMarginGroup(QCP::msLeft|QCP::msRight, group);\n  \\endcode\n  Here, we've used the first two axis rects of the plot and synchronized their left margins with\n  each other and their right margins with each other.\n*/\n\n/* start documentation of inline functions */\n\n/*! \\fn QList<QCPLayoutElement*> QCPMarginGroup::elements(QCP::MarginSide side) const\n  \n  Returns a list of all layout elements that have their margin \\a side associated with this margin\n  group.\n*/\n\n/* end documentation of inline functions */\n\n/*!\n  Creates a new QCPMarginGroup instance in \\a parentPlot.\n*/\nQCPMarginGroup::QCPMarginGroup(QCustomPlot *parentPlot) :\n  QObject(parentPlot),\n  mParentPlot(parentPlot)\n{\n  mChildren.insert(QCP::msLeft, QList<QCPLayoutElement*>());\n  mChildren.insert(QCP::msRight, QList<QCPLayoutElement*>());\n  mChildren.insert(QCP::msTop, QList<QCPLayoutElement*>());\n  mChildren.insert(QCP::msBottom, QList<QCPLayoutElement*>());\n}\n\nQCPMarginGroup::~QCPMarginGroup()\n{\n  clear();\n}\n\n/*!\n  Returns whether this margin group is empty. If this function returns true, no layout elements use\n  this margin group to synchronize margin sides.\n*/\nbool QCPMarginGroup::isEmpty() const\n{\n  QHashIterator<QCP::MarginSide, QList<QCPLayoutElement*> > it(mChildren);\n  while (it.hasNext())\n  {\n    it.next();\n    if (!it.value().isEmpty())\n      return false;\n  }\n  return true;\n}\n\n/*!\n  Clears this margin group. The synchronization of the margin sides that use this margin group is\n  lifted and they will use their individual margin sizes again.\n*/\nvoid QCPMarginGroup::clear()\n{\n  // make all children remove themselves from this margin group:\n  QHashIterator<QCP::MarginSide, QList<QCPLayoutElement*> > it(mChildren);\n  while (it.hasNext())\n  {\n    it.next();\n    const QList<QCPLayoutElement*> elements = it.value();\n    for (int i=elements.size()-1; i>=0; --i)\n      elements.at(i)->setMarginGroup(it.key(), 0); // removes itself from mChildren via removeChild\n  }\n}\n\n/*! \\internal\n  \n  Returns the synchronized common margin for \\a side. This is the margin value that will be used by\n  the layout element on the respective side, if it is part of this margin group.\n  \n  The common margin is calculated by requesting the automatic margin (\\ref\n  QCPLayoutElement::calculateAutoMargin) of each element associated with \\a side in this margin\n  group, and choosing the largest returned value. (QCPLayoutElement::minimumMargins is taken into\n  account, too.)\n*/\nint QCPMarginGroup::commonMargin(QCP::MarginSide side) const\n{\n  // query all automatic margins of the layout elements in this margin group side and find maximum:\n  int result = 0;\n  const QList<QCPLayoutElement*> elements = mChildren.value(side);\n  for (int i=0; i<elements.size(); ++i)\n  {\n    if (!elements.at(i)->autoMargins().testFlag(side))\n      continue;\n    int m = qMax(elements.at(i)->calculateAutoMargin(side), QCP::getMarginValue(elements.at(i)->minimumMargins(), side));\n    if (m > result)\n      result = m;\n  }\n  return result;\n}\n\n/*! \\internal\n  \n  Adds \\a element to the internal list of child elements, for the margin \\a side.\n  \n  This function does not modify the margin group property of \\a element.\n*/\nvoid QCPMarginGroup::addChild(QCP::MarginSide side, QCPLayoutElement *element)\n{\n  if (!mChildren[side].contains(element))\n    mChildren[side].append(element);\n  else\n    qDebug() << Q_FUNC_INFO << \"element is already child of this margin group side\" << reinterpret_cast<quintptr>(element);\n}\n\n/*! \\internal\n  \n  Removes \\a element from the internal list of child elements, for the margin \\a side.\n  \n  This function does not modify the margin group property of \\a element.\n*/\nvoid QCPMarginGroup::removeChild(QCP::MarginSide side, QCPLayoutElement *element)\n{\n  if (!mChildren[side].removeOne(element))\n    qDebug() << Q_FUNC_INFO << \"element is not child of this margin group side\" << reinterpret_cast<quintptr>(element);\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPLayoutElement\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPLayoutElement\n  \\brief The abstract base class for all objects that form \\ref thelayoutsystem \"the layout system\".\n  \n  This is an abstract base class. As such, it can't be instantiated directly, rather use one of its subclasses.\n  \n  A Layout element is a rectangular object which can be placed in layouts. It has an outer rect\n  (QCPLayoutElement::outerRect) and an inner rect (\\ref QCPLayoutElement::rect). The difference\n  between outer and inner rect is called its margin. The margin can either be set to automatic or\n  manual (\\ref setAutoMargins) on a per-side basis. If a side is set to manual, that margin can be\n  set explicitly with \\ref setMargins and will stay fixed at that value. If it's set to automatic,\n  the layout element subclass will control the value itself (via \\ref calculateAutoMargin).\n  \n  Layout elements can be placed in layouts (base class QCPLayout) like QCPLayoutGrid. The top level\n  layout is reachable via \\ref QCustomPlot::plotLayout, and is a \\ref QCPLayoutGrid. Since \\ref\n  QCPLayout itself derives from \\ref QCPLayoutElement, layouts can be nested.\n  \n  Thus in QCustomPlot one can divide layout elements into two categories: The ones that are\n  invisible by themselves, because they don't draw anything. Their only purpose is to manage the\n  position and size of other layout elements. This category of layout elements usually use\n  QCPLayout as base class. Then there is the category of layout elements which actually draw\n  something. For example, QCPAxisRect, QCPLegend and QCPPlotTitle are of this category. This does\n  not necessarily mean that the latter category can't have child layout elements. QCPLegend for\n  instance, actually derives from QCPLayoutGrid and the individual legend items are child layout\n  elements in the grid layout.\n*/\n\n/* start documentation of inline functions */\n\n/*! \\fn QCPLayout *QCPLayoutElement::layout() const\n  \n  Returns the parent layout of this layout element.\n*/\n\n/*! \\fn QRect QCPLayoutElement::rect() const\n  \n  Returns the inner rect of this layout element. The inner rect is the outer rect (\\ref\n  setOuterRect) shrinked by the margins (\\ref setMargins, \\ref setAutoMargins).\n  \n  In some cases, the area between outer and inner rect is left blank. In other cases the margin\n  area is used to display peripheral graphics while the main content is in the inner rect. This is\n  where automatic margin calculation becomes interesting because it allows the layout element to\n  adapt the margins to the peripheral graphics it wants to draw. For example, \\ref QCPAxisRect\n  draws the axis labels and tick labels in the margin area, thus needs to adjust the margins (if\n  \\ref setAutoMargins is enabled) according to the space required by the labels of the axes.\n*/\n\n/*! \\fn virtual void QCPLayoutElement::mousePressEvent(QMouseEvent *event)\n  \n  This event is called, if the mouse was pressed while being inside the outer rect of this layout\n  element.\n*/\n\n/*! \\fn virtual void QCPLayoutElement::mouseMoveEvent(QMouseEvent *event)\n  \n  This event is called, if the mouse is moved inside the outer rect of this layout element.\n*/\n\n/*! \\fn virtual void QCPLayoutElement::mouseReleaseEvent(QMouseEvent *event)\n  \n  This event is called, if the mouse was previously pressed inside the outer rect of this layout\n  element and is now released.\n*/\n\n/*! \\fn virtual void QCPLayoutElement::mouseDoubleClickEvent(QMouseEvent *event)\n  \n  This event is called, if the mouse is double-clicked inside the outer rect of this layout\n  element.\n*/\n\n/*! \\fn virtual void QCPLayoutElement::wheelEvent(QWheelEvent *event)\n  \n  This event is called, if the mouse wheel is scrolled while the cursor is inside the rect of this\n  layout element.\n*/\n\n/* end documentation of inline functions */\n\n/*!\n  Creates an instance of QCPLayoutElement and sets default values.\n*/\nQCPLayoutElement::QCPLayoutElement(QCustomPlot *parentPlot) :\n  QCPLayerable(parentPlot), // parenthood is changed as soon as layout element gets inserted into a layout (except for top level layout)\n  mParentLayout(0),\n  mMinimumSize(),\n  mMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX),\n  mRect(0, 0, 0, 0),\n  mOuterRect(0, 0, 0, 0),\n  mMargins(0, 0, 0, 0),\n  mMinimumMargins(0, 0, 0, 0),\n  mAutoMargins(QCP::msAll)\n{\n}\n\nQCPLayoutElement::~QCPLayoutElement()\n{\n  setMarginGroup(QCP::msAll, 0); // unregister at margin groups, if there are any\n  // unregister at layout:\n  if (qobject_cast<QCPLayout*>(mParentLayout)) // the qobject_cast is just a safeguard in case the layout forgets to call clear() in its dtor and this dtor is called by QObject dtor\n    mParentLayout->take(this);\n}\n\n/*!\n  Sets the outer rect of this layout element. If the layout element is inside a layout, the layout\n  sets the position and size of this layout element using this function.\n  \n  Calling this function externally has no effect, since the layout will overwrite any changes to\n  the outer rect upon the next replot.\n  \n  The layout element will adapt its inner \\ref rect by applying the margins inward to the outer rect.\n  \n  \\see rect\n*/\nvoid QCPLayoutElement::setOuterRect(const QRect &rect)\n{\n  if (mOuterRect != rect)\n  {\n    mOuterRect = rect;\n    mRect = mOuterRect.adjusted(mMargins.left(), mMargins.top(), -mMargins.right(), -mMargins.bottom());\n  }\n}\n\n/*!\n  Sets the margins of this layout element. If \\ref setAutoMargins is disabled for some or all\n  sides, this function is used to manually set the margin on those sides. Sides that are still set\n  to be handled automatically are ignored and may have any value in \\a margins.\n  \n  The margin is the distance between the outer rect (controlled by the parent layout via \\ref\n  setOuterRect) and the inner \\ref rect (which usually contains the main content of this layout\n  element).\n  \n  \\see setAutoMargins\n*/\nvoid QCPLayoutElement::setMargins(const QMargins &margins)\n{\n  if (mMargins != margins)\n  {\n    mMargins = margins;\n    mRect = mOuterRect.adjusted(mMargins.left(), mMargins.top(), -mMargins.right(), -mMargins.bottom());\n  }\n}\n\n/*!\n  If \\ref setAutoMargins is enabled on some or all margins, this function is used to provide\n  minimum values for those margins.\n  \n  The minimum values are not enforced on margin sides that were set to be under manual control via\n  \\ref setAutoMargins.\n  \n  \\see setAutoMargins\n*/\nvoid QCPLayoutElement::setMinimumMargins(const QMargins &margins)\n{\n  if (mMinimumMargins != margins)\n  {\n    mMinimumMargins = margins;\n  }\n}\n\n/*!\n  Sets on which sides the margin shall be calculated automatically. If a side is calculated\n  automatically, a minimum margin value may be provided with \\ref setMinimumMargins. If a side is\n  set to be controlled manually, the value may be specified with \\ref setMargins.\n  \n  Margin sides that are under automatic control may participate in a \\ref QCPMarginGroup (see \\ref\n  setMarginGroup), to synchronize (align) it with other layout elements in the plot.\n  \n  \\see setMinimumMargins, setMargins\n*/\nvoid QCPLayoutElement::setAutoMargins(QCP::MarginSides sides)\n{\n  mAutoMargins = sides;\n}\n\n/*!\n  Sets the minimum size for the inner \\ref rect of this layout element. A parent layout tries to\n  respect the \\a size here by changing row/column sizes in the layout accordingly.\n  \n  If the parent layout size is not sufficient to satisfy all minimum size constraints of its child\n  layout elements, the layout may set a size that is actually smaller than \\a size. QCustomPlot\n  propagates the layout's size constraints to the outside by setting its own minimum QWidget size\n  accordingly, so violations of \\a size should be exceptions.\n*/\nvoid QCPLayoutElement::setMinimumSize(const QSize &size)\n{\n  if (mMinimumSize != size)\n  {\n    mMinimumSize = size;\n    if (mParentLayout)\n      mParentLayout->sizeConstraintsChanged();\n  }\n}\n\n/*! \\overload\n  \n  Sets the minimum size for the inner \\ref rect of this layout element.\n*/\nvoid QCPLayoutElement::setMinimumSize(int width, int height)\n{\n  setMinimumSize(QSize(width, height));\n}\n\n/*!\n  Sets the maximum size for the inner \\ref rect of this layout element. A parent layout tries to\n  respect the \\a size here by changing row/column sizes in the layout accordingly.\n*/\nvoid QCPLayoutElement::setMaximumSize(const QSize &size)\n{\n  if (mMaximumSize != size)\n  {\n    mMaximumSize = size;\n    if (mParentLayout)\n      mParentLayout->sizeConstraintsChanged();\n  }\n}\n\n/*! \\overload\n  \n  Sets the maximum size for the inner \\ref rect of this layout element.\n*/\nvoid QCPLayoutElement::setMaximumSize(int width, int height)\n{\n  setMaximumSize(QSize(width, height));\n}\n\n/*!\n  Sets the margin \\a group of the specified margin \\a sides.\n  \n  Margin groups allow synchronizing specified margins across layout elements, see the documentation\n  of \\ref QCPMarginGroup.\n  \n  To unset the margin group of \\a sides, set \\a group to 0.\n  \n  Note that margin groups only work for margin sides that are set to automatic (\\ref\n  setAutoMargins).\n*/\nvoid QCPLayoutElement::setMarginGroup(QCP::MarginSides sides, QCPMarginGroup *group)\n{\n  QVector<QCP::MarginSide> sideVector;\n  if (sides.testFlag(QCP::msLeft)) sideVector.append(QCP::msLeft);\n  if (sides.testFlag(QCP::msRight)) sideVector.append(QCP::msRight);\n  if (sides.testFlag(QCP::msTop)) sideVector.append(QCP::msTop);\n  if (sides.testFlag(QCP::msBottom)) sideVector.append(QCP::msBottom);\n  \n  for (int i=0; i<sideVector.size(); ++i)\n  {\n    QCP::MarginSide side = sideVector.at(i);\n    if (marginGroup(side) != group)\n    {\n      QCPMarginGroup *oldGroup = marginGroup(side);\n      if (oldGroup) // unregister at old group\n        oldGroup->removeChild(side, this);\n      \n      if (!group) // if setting to 0, remove hash entry. Else set hash entry to new group and register there\n      {\n        mMarginGroups.remove(side);\n      } else // setting to a new group\n      {\n        mMarginGroups[side] = group;\n        group->addChild(side, this);\n      }\n    }\n  }\n}\n\n/*!\n  Updates the layout element and sub-elements. This function is automatically called before every\n  replot by the parent layout element. It is called multiple times, once for every \\ref\n  UpdatePhase. The phases are run through in the order of the enum values. For details about what\n  happens at the different phases, see the documentation of \\ref UpdatePhase.\n  \n  Layout elements that have child elements should call the \\ref update method of their child\n  elements, and pass the current \\a phase unchanged.\n  \n  The default implementation executes the automatic margin mechanism in the \\ref upMargins phase.\n  Subclasses should make sure to call the base class implementation.\n*/\nvoid QCPLayoutElement::update(UpdatePhase phase)\n{\n  if (phase == upMargins)\n  {\n    if (mAutoMargins != QCP::msNone)\n    {\n      // set the margins of this layout element according to automatic margin calculation, either directly or via a margin group:\n      QMargins newMargins = mMargins;\n      foreach (QCP::MarginSide side, QList<QCP::MarginSide>() << QCP::msLeft << QCP::msRight << QCP::msTop << QCP::msBottom)\n      {\n        if (mAutoMargins.testFlag(side)) // this side's margin shall be calculated automatically\n        {\n          if (mMarginGroups.contains(side))\n            QCP::setMarginValue(newMargins, side, mMarginGroups[side]->commonMargin(side)); // this side is part of a margin group, so get the margin value from that group\n          else\n            QCP::setMarginValue(newMargins, side, calculateAutoMargin(side)); // this side is not part of a group, so calculate the value directly\n          // apply minimum margin restrictions:\n          if (QCP::getMarginValue(newMargins, side) < QCP::getMarginValue(mMinimumMargins, side))\n            QCP::setMarginValue(newMargins, side, QCP::getMarginValue(mMinimumMargins, side));\n        }\n      }\n      setMargins(newMargins);\n    }\n  }\n}\n\n/*!\n  Returns the minimum size this layout element (the inner \\ref rect) may be compressed to.\n  \n  if a minimum size (\\ref setMinimumSize) was not set manually, parent layouts consult this\n  function to determine the minimum allowed size of this layout element. (A manual minimum size is\n  considered set if it is non-zero.)\n*/\nQSize QCPLayoutElement::minimumSizeHint() const\n{\n  return mMinimumSize;\n}\n\n/*!\n  Returns the maximum size this layout element (the inner \\ref rect) may be expanded to.\n  \n  if a maximum size (\\ref setMaximumSize) was not set manually, parent layouts consult this\n  function to determine the maximum allowed size of this layout element. (A manual maximum size is\n  considered set if it is smaller than Qt's QWIDGETSIZE_MAX.)\n*/\nQSize QCPLayoutElement::maximumSizeHint() const\n{\n  return mMaximumSize;\n}\n\n/*!\n  Returns a list of all child elements in this layout element. If \\a recursive is true, all\n  sub-child elements are included in the list, too.\n  \n  \\warning There may be entries with value 0 in the returned list. (For example, QCPLayoutGrid may have\n  empty cells which yield 0 at the respective index.)\n*/\nQList<QCPLayoutElement*> QCPLayoutElement::elements(bool recursive) const\n{\n  Q_UNUSED(recursive)\n  return QList<QCPLayoutElement*>();\n}\n\n/*!\n  Layout elements are sensitive to events inside their outer rect. If \\a pos is within the outer\n  rect, this method returns a value corresponding to 0.99 times the parent plot's selection\n  tolerance. However, layout elements are not selectable by default. So if \\a onlySelectable is\n  true, -1.0 is returned.\n  \n  See \\ref QCPLayerable::selectTest for a general explanation of this virtual method.\n  \n  QCPLayoutElement subclasses may reimplement this method to provide more specific selection test\n  behaviour.\n*/\ndouble QCPLayoutElement::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const\n{\n  Q_UNUSED(details)\n  \n  if (onlySelectable)\n    return -1;\n  \n  if (QRectF(mOuterRect).contains(pos))\n  {\n    if (mParentPlot)\n      return mParentPlot->selectionTolerance()*0.99;\n    else\n    {\n      qDebug() << Q_FUNC_INFO << \"parent plot not defined\";\n      return -1;\n    }\n  } else\n    return -1;\n}\n\n/*! \\internal\n  \n  propagates the parent plot initialization to all child elements, by calling \\ref\n  QCPLayerable::initializeParentPlot on them.\n*/\nvoid QCPLayoutElement::parentPlotInitialized(QCustomPlot *parentPlot)\n{\n  foreach (QCPLayoutElement* el, elements(false))\n  {\n    if (!el->parentPlot())\n      el->initializeParentPlot(parentPlot);\n  }\n}\n\n/*! \\internal\n  \n  Returns the margin size for this \\a side. It is used if automatic margins is enabled for this \\a\n  side (see \\ref setAutoMargins). If a minimum margin was set with \\ref setMinimumMargins, the\n  returned value will not be smaller than the specified minimum margin.\n  \n  The default implementation just returns the respective manual margin (\\ref setMargins) or the\n  minimum margin, whichever is larger.\n*/\nint QCPLayoutElement::calculateAutoMargin(QCP::MarginSide side)\n{\n  return qMax(QCP::getMarginValue(mMargins, side), QCP::getMarginValue(mMinimumMargins, side));\n}\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPLayout\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPLayout\n  \\brief The abstract base class for layouts\n  \n  This is an abstract base class for layout elements whose main purpose is to define the position\n  and size of other child layout elements. In most cases, layouts don't draw anything themselves\n  (but there are exceptions to this, e.g. QCPLegend).\n  \n  QCPLayout derives from QCPLayoutElement, and thus can itself be nested in other layouts.\n  \n  QCPLayout introduces a common interface for accessing and manipulating the child elements. Those\n  functions are most notably \\ref elementCount, \\ref elementAt, \\ref takeAt, \\ref take, \\ref\n  simplify, \\ref removeAt, \\ref remove and \\ref clear. Individual subclasses may add more functions\n  to this interface which are more specialized to the form of the layout. For example, \\ref\n  QCPLayoutGrid adds functions that take row and column indices to access cells of the layout grid\n  more conveniently.\n  \n  Since this is an abstract base class, you can't instantiate it directly. Rather use one of its\n  subclasses like QCPLayoutGrid or QCPLayoutInset.\n  \n  For a general introduction to the layout system, see the dedicated documentation page \\ref\n  thelayoutsystem \"The Layout System\".\n*/\n\n/* start documentation of pure virtual functions */\n\n/*! \\fn virtual int QCPLayout::elementCount() const = 0\n  \n  Returns the number of elements/cells in the layout.\n  \n  \\see elements, elementAt\n*/\n\n/*! \\fn virtual QCPLayoutElement* QCPLayout::elementAt(int index) const = 0\n  \n  Returns the element in the cell with the given \\a index. If \\a index is invalid, returns 0.\n  \n  Note that even if \\a index is valid, the respective cell may be empty in some layouts (e.g.\n  QCPLayoutGrid), so this function may return 0 in those cases. You may use this function to check\n  whether a cell is empty or not.\n  \n  \\see elements, elementCount, takeAt\n*/\n\n/*! \\fn virtual QCPLayoutElement* QCPLayout::takeAt(int index) = 0\n  \n  Removes the element with the given \\a index from the layout and returns it.\n  \n  If the \\a index is invalid or the cell with that index is empty, returns 0.\n  \n  Note that some layouts don't remove the respective cell right away but leave an empty cell after\n  successful removal of the layout element. To collapse empty cells, use \\ref simplify.\n  \n  \\see elementAt, take\n*/\n\n/*! \\fn virtual bool QCPLayout::take(QCPLayoutElement* element) = 0\n  \n  Removes the specified \\a element from the layout and returns true on success.\n  \n  If the \\a element isn't in this layout, returns false.\n  \n  Note that some layouts don't remove the respective cell right away but leave an empty cell after\n  successful removal of the layout element. To collapse empty cells, use \\ref simplify.\n  \n  \\see takeAt\n*/\n\n/* end documentation of pure virtual functions */\n\n/*!\n  Creates an instance of QCPLayout and sets default values. Note that since QCPLayout\n  is an abstract base class, it can't be instantiated directly.\n*/\nQCPLayout::QCPLayout()\n{\n}\n\n/*!\n  First calls the QCPLayoutElement::update base class implementation to update the margins on this\n  layout.\n  \n  Then calls \\ref updateLayout which subclasses reimplement to reposition and resize their cells.\n  \n  Finally, \\ref update is called on all child elements.\n*/\nvoid QCPLayout::update(UpdatePhase phase)\n{\n  QCPLayoutElement::update(phase);\n  \n  // set child element rects according to layout:\n  if (phase == upLayout)\n    updateLayout();\n  \n  // propagate update call to child elements:\n  const int elCount = elementCount();\n  for (int i=0; i<elCount; ++i)\n  {\n    if (QCPLayoutElement *el = elementAt(i))\n      el->update(phase);\n  }\n}\n\n/* inherits documentation from base class */\nQList<QCPLayoutElement*> QCPLayout::elements(bool recursive) const\n{\n  const int c = elementCount();\n  QList<QCPLayoutElement*> result;\n#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)\n  result.reserve(c);\n#endif\n  for (int i=0; i<c; ++i)\n    result.append(elementAt(i));\n  if (recursive)\n  {\n    for (int i=0; i<c; ++i)\n    {\n      if (result.at(i))\n        result << result.at(i)->elements(recursive);\n    }\n  }\n  return result;\n}\n\n/*!\n  Simplifies the layout by collapsing empty cells. The exact behavior depends on subclasses, the\n  default implementation does nothing.\n  \n  Not all layouts need simplification. For example, QCPLayoutInset doesn't use explicit\n  simplification while QCPLayoutGrid does.\n*/\nvoid QCPLayout::simplify()\n{\n}\n\n/*!\n  Removes and deletes the element at the provided \\a index. Returns true on success. If \\a index is\n  invalid or points to an empty cell, returns false.\n  \n  This function internally uses \\ref takeAt to remove the element from the layout and then deletes\n  the returned element.\n  \n  \\see remove, takeAt\n*/\nbool QCPLayout::removeAt(int index)\n{\n  if (QCPLayoutElement *el = takeAt(index))\n  {\n    delete el;\n    return true;\n  } else\n    return false;\n}\n\n/*!\n  Removes and deletes the provided \\a element. Returns true on success. If \\a element is not in the\n  layout, returns false.\n  \n  This function internally uses \\ref takeAt to remove the element from the layout and then deletes\n  the element.\n  \n  \\see removeAt, take\n*/\nbool QCPLayout::remove(QCPLayoutElement *element)\n{\n  if (take(element))\n  {\n    delete element;\n    return true;\n  } else\n    return false;\n}\n\n/*!\n  Removes and deletes all layout elements in this layout.\n  \n  \\see remove, removeAt\n*/\nvoid QCPLayout::clear()\n{\n  for (int i=elementCount()-1; i>=0; --i)\n  {\n    if (elementAt(i))\n      removeAt(i);\n  }\n  simplify();\n}\n\n/*!\n  Subclasses call this method to report changed (minimum/maximum) size constraints.\n  \n  If the parent of this layout is again a QCPLayout, forwards the call to the parent's \\ref\n  sizeConstraintsChanged. If the parent is a QWidget (i.e. is the \\ref QCustomPlot::plotLayout of\n  QCustomPlot), calls QWidget::updateGeometry, so if the QCustomPlot widget is inside a Qt QLayout,\n  it may update itself and resize cells accordingly.\n*/\nvoid QCPLayout::sizeConstraintsChanged() const\n{\n  if (QWidget *w = qobject_cast<QWidget*>(parent()))\n    w->updateGeometry();\n  else if (QCPLayout *l = qobject_cast<QCPLayout*>(parent()))\n    l->sizeConstraintsChanged();\n}\n\n/*! \\internal\n  \n  Subclasses reimplement this method to update the position and sizes of the child elements/cells\n  via calling their \\ref QCPLayoutElement::setOuterRect. The default implementation does nothing.\n  \n  The geometry used as a reference is the inner \\ref rect of this layout. Child elements should stay\n  within that rect.\n  \n  \\ref getSectionSizes may help with the reimplementation of this function.\n  \n  \\see update\n*/\nvoid QCPLayout::updateLayout()\n{\n}\n\n\n/*! \\internal\n  \n  Associates \\a el with this layout. This is done by setting the \\ref QCPLayoutElement::layout, the\n  \\ref QCPLayerable::parentLayerable and the QObject parent to this layout.\n  \n  Further, if \\a el didn't previously have a parent plot, calls \\ref\n  QCPLayerable::initializeParentPlot on \\a el to set the paret plot.\n  \n  This method is used by subclass specific methods that add elements to the layout. Note that this\n  method only changes properties in \\a el. The removal from the old layout and the insertion into\n  the new layout must be done additionally.\n*/\nvoid QCPLayout::adoptElement(QCPLayoutElement *el)\n{\n  if (el)\n  {\n    el->mParentLayout = this;\n    el->setParentLayerable(this);\n    el->setParent(this);\n    if (!el->parentPlot())\n      el->initializeParentPlot(mParentPlot);\n  } else\n    qDebug() << Q_FUNC_INFO << \"Null element passed\";\n}\n\n/*! \\internal\n  \n  Disassociates \\a el from this layout. This is done by setting the \\ref QCPLayoutElement::layout\n  and the \\ref QCPLayerable::parentLayerable to zero. The QObject parent is set to the parent\n  QCustomPlot.\n  \n  This method is used by subclass specific methods that remove elements from the layout (e.g. \\ref\n  take or \\ref takeAt). Note that this method only changes properties in \\a el. The removal from\n  the old layout must be done additionally.\n*/\nvoid QCPLayout::releaseElement(QCPLayoutElement *el)\n{\n  if (el)\n  {\n    el->mParentLayout = 0;\n    el->setParentLayerable(0);\n    el->setParent(mParentPlot);\n    // Note: Don't initializeParentPlot(0) here, because layout element will stay in same parent plot\n  } else\n    qDebug() << Q_FUNC_INFO << \"Null element passed\";\n}\n\n/*! \\internal\n  \n  This is a helper function for the implementation of \\ref updateLayout in subclasses.\n  \n  It calculates the sizes of one-dimensional sections with provided constraints on maximum section\n  sizes, minimum section sizes, relative stretch factors and the final total size of all sections.\n  \n  The QVector entries refer to the sections. Thus all QVectors must have the same size.\n  \n  \\a maxSizes gives the maximum allowed size of each section. If there shall be no maximum size\n  imposed, set all vector values to Qt's QWIDGETSIZE_MAX.\n  \n  \\a minSizes gives the minimum allowed size of each section. If there shall be no minimum size\n  imposed, set all vector values to zero. If the \\a minSizes entries add up to a value greater than\n  \\a totalSize, sections will be scaled smaller than the proposed minimum sizes. (In other words,\n  not exceeding the allowed total size is taken to be more important than not going below minimum\n  section sizes.)\n  \n  \\a stretchFactors give the relative proportions of the sections to each other. If all sections\n  shall be scaled equally, set all values equal. If the first section shall be double the size of\n  each individual other section, set the first number of \\a stretchFactors to double the value of\n  the other individual values (e.g. {2, 1, 1, 1}).\n  \n  \\a totalSize is the value that the final section sizes will add up to. Due to rounding, the\n  actual sum may differ slightly. If you want the section sizes to sum up to exactly that value,\n  you could distribute the remaining difference on the sections.\n  \n  The return value is a QVector containing the section sizes.\n*/\nQVector<int> QCPLayout::getSectionSizes(QVector<int> maxSizes, QVector<int> minSizes, QVector<double> stretchFactors, int totalSize) const\n{\n  if (maxSizes.size() != minSizes.size() || minSizes.size() != stretchFactors.size())\n  {\n    qDebug() << Q_FUNC_INFO << \"Passed vector sizes aren't equal:\" << maxSizes << minSizes << stretchFactors;\n    return QVector<int>();\n  }\n  if (stretchFactors.isEmpty())\n    return QVector<int>();\n  int sectionCount = stretchFactors.size();\n  QVector<double> sectionSizes(sectionCount);\n  // if provided total size is forced smaller than total minimum size, ignore minimum sizes (squeeze sections):\n  int minSizeSum = 0;\n  for (int i=0; i<sectionCount; ++i)\n    minSizeSum += minSizes.at(i);\n  if (totalSize < minSizeSum)\n  {\n    // new stretch factors are minimum sizes and minimum sizes are set to zero:\n    for (int i=0; i<sectionCount; ++i)\n    {\n      stretchFactors[i] = minSizes.at(i);\n      minSizes[i] = 0;\n    }\n  }\n  \n  QList<int> minimumLockedSections;\n  QList<int> unfinishedSections;\n  for (int i=0; i<sectionCount; ++i)\n    unfinishedSections.append(i);\n  double freeSize = totalSize;\n  \n  int outerIterations = 0;\n  while (!unfinishedSections.isEmpty() && outerIterations < sectionCount*2) // the iteration check ist just a failsafe in case something really strange happens\n  {\n    ++outerIterations;\n    int innerIterations = 0;\n    while (!unfinishedSections.isEmpty() && innerIterations < sectionCount*2) // the iteration check ist just a failsafe in case something really strange happens\n    {\n      ++innerIterations;\n      // find section that hits its maximum next:\n      int nextId = -1;\n      double nextMax = 1e12;\n      for (int i=0; i<unfinishedSections.size(); ++i)\n      {\n        int secId = unfinishedSections.at(i);\n        double hitsMaxAt = (maxSizes.at(secId)-sectionSizes.at(secId))/stretchFactors.at(secId);\n        if (hitsMaxAt < nextMax)\n        {\n          nextMax = hitsMaxAt;\n          nextId = secId;\n        }\n      }\n      // check if that maximum is actually within the bounds of the total size (i.e. can we stretch all remaining sections so far that the found section\n      // actually hits its maximum, without exceeding the total size when we add up all sections)\n      double stretchFactorSum = 0;\n      for (int i=0; i<unfinishedSections.size(); ++i)\n        stretchFactorSum += stretchFactors.at(unfinishedSections.at(i));\n      double nextMaxLimit = freeSize/stretchFactorSum;\n      if (nextMax < nextMaxLimit) // next maximum is actually hit, move forward to that point and fix the size of that section\n      {\n        for (int i=0; i<unfinishedSections.size(); ++i)\n        {\n          sectionSizes[unfinishedSections.at(i)] += nextMax*stretchFactors.at(unfinishedSections.at(i)); // increment all sections\n          freeSize -= nextMax*stretchFactors.at(unfinishedSections.at(i));\n        }\n        unfinishedSections.removeOne(nextId); // exclude the section that is now at maximum from further changes\n      } else // next maximum isn't hit, just distribute rest of free space on remaining sections\n      {\n        for (int i=0; i<unfinishedSections.size(); ++i)\n          sectionSizes[unfinishedSections.at(i)] += nextMaxLimit*stretchFactors.at(unfinishedSections.at(i)); // increment all sections\n        unfinishedSections.clear();\n      }\n    }\n    if (innerIterations == sectionCount*2)\n      qDebug() << Q_FUNC_INFO << \"Exceeded maximum expected inner iteration count, layouting aborted. Input was:\" << maxSizes << minSizes << stretchFactors << totalSize;\n    \n    // now check whether the resulting section sizes violate minimum restrictions:\n    bool foundMinimumViolation = false;\n    for (int i=0; i<sectionSizes.size(); ++i)\n    {\n      if (minimumLockedSections.contains(i))\n        continue;\n      if (sectionSizes.at(i) < minSizes.at(i)) // section violates minimum\n      {\n        sectionSizes[i] = minSizes.at(i); // set it to minimum\n        foundMinimumViolation = true; // make sure we repeat the whole optimization process\n        minimumLockedSections.append(i);\n      }\n    }\n    if (foundMinimumViolation)\n    {\n      freeSize = totalSize;\n      for (int i=0; i<sectionCount; ++i)\n      {\n        if (!minimumLockedSections.contains(i)) // only put sections that haven't hit their minimum back into the pool\n          unfinishedSections.append(i);\n        else\n          freeSize -= sectionSizes.at(i); // remove size of minimum locked sections from available space in next round\n      }\n      // reset all section sizes to zero that are in unfinished sections (all others have been set to their minimum):\n      for (int i=0; i<unfinishedSections.size(); ++i)\n        sectionSizes[unfinishedSections.at(i)] = 0;\n    }\n  }\n  if (outerIterations == sectionCount*2)\n    qDebug() << Q_FUNC_INFO << \"Exceeded maximum expected outer iteration count, layouting aborted. Input was:\" << maxSizes << minSizes << stretchFactors << totalSize;\n  \n  QVector<int> result(sectionCount);\n  for (int i=0; i<sectionCount; ++i)\n    result[i] = qRound(sectionSizes.at(i));\n  return result;\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPLayoutGrid\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPLayoutGrid\n  \\brief A layout that arranges child elements in a grid\n  \n  Elements are laid out in a grid with configurable stretch factors (\\ref setColumnStretchFactor,\n  \\ref setRowStretchFactor) and spacing (\\ref setColumnSpacing, \\ref setRowSpacing).\n  \n  Elements can be added to cells via \\ref addElement. The grid is expanded if the specified row or\n  column doesn't exist yet. Whether a cell contains a valid layout element can be checked with \\ref\n  hasElement, that element can be retrieved with \\ref element. If rows and columns that only have\n  empty cells shall be removed, call \\ref simplify. Removal of elements is either done by just\n  adding the element to a different layout or by using the QCPLayout interface \\ref take or \\ref\n  remove.\n  \n  Row and column insertion can be performed with \\ref insertRow and \\ref insertColumn.\n*/\n\n/*!\n  Creates an instance of QCPLayoutGrid and sets default values.\n*/\nQCPLayoutGrid::QCPLayoutGrid() :\n  mColumnSpacing(5),\n  mRowSpacing(5)\n{\n}\n\nQCPLayoutGrid::~QCPLayoutGrid()\n{\n  // clear all child layout elements. This is important because only the specific layouts know how\n  // to handle removing elements (clear calls virtual removeAt method to do that).\n  clear();\n}\n\n/*!\n  Returns the element in the cell in \\a row and \\a column.\n  \n  Returns 0 if either the row/column is invalid or if the cell is empty. In those cases, a qDebug\n  message is printed. To check whether a cell exists and isn't empty, use \\ref hasElement.\n  \n  \\see addElement, hasElement\n*/\nQCPLayoutElement *QCPLayoutGrid::element(int row, int column) const\n{\n  if (row >= 0 && row < mElements.size())\n  {\n    if (column >= 0 && column < mElements.first().size())\n    {\n      if (QCPLayoutElement *result = mElements.at(row).at(column))\n        return result;\n      else\n        qDebug() << Q_FUNC_INFO << \"Requested cell is empty. Row:\" << row << \"Column:\" << column;\n    } else\n      qDebug() << Q_FUNC_INFO << \"Invalid column. Row:\" << row << \"Column:\" << column;\n  } else\n    qDebug() << Q_FUNC_INFO << \"Invalid row. Row:\" << row << \"Column:\" << column;\n  return 0;\n}\n\n/*!\n  Returns the number of rows in the layout.\n  \n  \\see columnCount\n*/\nint QCPLayoutGrid::rowCount() const\n{\n  return mElements.size();\n}\n\n/*!\n  Returns the number of columns in the layout.\n  \n  \\see rowCount\n*/\nint QCPLayoutGrid::columnCount() const\n{\n  if (mElements.size() > 0)\n    return mElements.first().size();\n  else\n    return 0;\n}\n\n/*!\n  Adds the \\a element to cell with \\a row and \\a column. If \\a element is already in a layout, it\n  is first removed from there. If \\a row or \\a column don't exist yet, the layout is expanded\n  accordingly.\n  \n  Returns true if the element was added successfully, i.e. if the cell at \\a row and \\a column\n  didn't already have an element.\n  \n  \\see element, hasElement, take, remove\n*/\nbool QCPLayoutGrid::addElement(int row, int column, QCPLayoutElement *element)\n{\n  if (element)\n  {\n    if (!hasElement(row, column))\n    {\n      if (element->layout()) // remove from old layout first\n        element->layout()->take(element);\n      expandTo(row+1, column+1);\n      mElements[row][column] = element;\n      adoptElement(element);\n      return true;\n    } else\n      qDebug() << Q_FUNC_INFO << \"There is already an element in the specified row/column:\" << row << column;\n  } else\n    qDebug() << Q_FUNC_INFO << \"Can't add null element to row/column:\" << row << column;\n  return false;\n}\n\n/*!\n  Returns whether the cell at \\a row and \\a column exists and contains a valid element, i.e. isn't\n  empty.\n  \n  \\see element\n*/\nbool QCPLayoutGrid::hasElement(int row, int column)\n{\n  if (row >= 0 && row < rowCount() && column >= 0 && column < columnCount())\n    return mElements.at(row).at(column);\n  else\n    return false;\n}\n\n/*!\n  Sets the stretch \\a factor of \\a column.\n  \n  Stretch factors control the relative sizes of rows and columns. Cells will not be resized beyond\n  their minimum and maximum widths/heights (\\ref QCPLayoutElement::setMinimumSize, \\ref\n  QCPLayoutElement::setMaximumSize), regardless of the stretch factor.\n  \n  The default stretch factor of newly created rows/columns is 1.\n  \n  \\see setColumnStretchFactors, setRowStretchFactor\n*/\nvoid QCPLayoutGrid::setColumnStretchFactor(int column, double factor)\n{\n  if (column >= 0 && column < columnCount())\n  {\n    if (factor > 0)\n      mColumnStretchFactors[column] = factor;\n    else\n      qDebug() << Q_FUNC_INFO << \"Invalid stretch factor, must be positive:\" << factor;\n  } else\n    qDebug() << Q_FUNC_INFO << \"Invalid column:\" << column;\n}\n\n/*!\n  Sets the stretch \\a factors of all columns. \\a factors must have the size \\ref columnCount.\n  \n  Stretch factors control the relative sizes of rows and columns. Cells will not be resized beyond\n  their minimum and maximum widths/heights (\\ref QCPLayoutElement::setMinimumSize, \\ref\n  QCPLayoutElement::setMaximumSize), regardless of the stretch factor.\n  \n  The default stretch factor of newly created rows/columns is 1.\n  \n  \\see setColumnStretchFactor, setRowStretchFactors\n*/\nvoid QCPLayoutGrid::setColumnStretchFactors(const QList<double> &factors)\n{\n  if (factors.size() == mColumnStretchFactors.size())\n  {\n    mColumnStretchFactors = factors;\n    for (int i=0; i<mColumnStretchFactors.size(); ++i)\n    {\n      if (mColumnStretchFactors.at(i) <= 0)\n      {\n        qDebug() << Q_FUNC_INFO << \"Invalid stretch factor, must be positive:\" << mColumnStretchFactors.at(i);\n        mColumnStretchFactors[i] = 1;\n      }\n    }\n  } else\n    qDebug() << Q_FUNC_INFO << \"Column count not equal to passed stretch factor count:\" << factors;\n}\n\n/*!\n  Sets the stretch \\a factor of \\a row.\n  \n  Stretch factors control the relative sizes of rows and columns. Cells will not be resized beyond\n  their minimum and maximum widths/heights (\\ref QCPLayoutElement::setMinimumSize, \\ref\n  QCPLayoutElement::setMaximumSize), regardless of the stretch factor.\n  \n  The default stretch factor of newly created rows/columns is 1.\n  \n  \\see setColumnStretchFactors, setRowStretchFactor\n*/\nvoid QCPLayoutGrid::setRowStretchFactor(int row, double factor)\n{\n  if (row >= 0 && row < rowCount())\n  {\n    if (factor > 0)\n      mRowStretchFactors[row] = factor;\n    else\n      qDebug() << Q_FUNC_INFO << \"Invalid stretch factor, must be positive:\" << factor;\n  } else\n    qDebug() << Q_FUNC_INFO << \"Invalid row:\" << row;\n}\n\n/*!\n  Sets the stretch \\a factors of all rows. \\a factors must have the size \\ref rowCount.\n  \n  Stretch factors control the relative sizes of rows and columns. Cells will not be resized beyond\n  their minimum and maximum widths/heights (\\ref QCPLayoutElement::setMinimumSize, \\ref\n  QCPLayoutElement::setMaximumSize), regardless of the stretch factor.\n  \n  The default stretch factor of newly created rows/columns is 1.\n  \n  \\see setRowStretchFactor, setColumnStretchFactors\n*/\nvoid QCPLayoutGrid::setRowStretchFactors(const QList<double> &factors)\n{\n  if (factors.size() == mRowStretchFactors.size())\n  {\n    mRowStretchFactors = factors;\n    for (int i=0; i<mRowStretchFactors.size(); ++i)\n    {\n      if (mRowStretchFactors.at(i) <= 0)\n      {\n        qDebug() << Q_FUNC_INFO << \"Invalid stretch factor, must be positive:\" << mRowStretchFactors.at(i);\n        mRowStretchFactors[i] = 1;\n      }\n    }\n  } else\n    qDebug() << Q_FUNC_INFO << \"Row count not equal to passed stretch factor count:\" << factors;\n}\n\n/*!\n  Sets the gap that is left blank between columns to \\a pixels.\n  \n  \\see setRowSpacing\n*/\nvoid QCPLayoutGrid::setColumnSpacing(int pixels)\n{\n  mColumnSpacing = pixels;\n}\n\n/*!\n  Sets the gap that is left blank between rows to \\a pixels.\n  \n  \\see setColumnSpacing\n*/\nvoid QCPLayoutGrid::setRowSpacing(int pixels)\n{\n  mRowSpacing = pixels;\n}\n\n/*!\n  Expands the layout to have \\a newRowCount rows and \\a newColumnCount columns. So the last valid\n  row index will be \\a newRowCount-1, the last valid column index will be \\a newColumnCount-1.\n  \n  If the current column/row count is already larger or equal to \\a newColumnCount/\\a newRowCount,\n  this function does nothing in that dimension.\n  \n  Newly created cells are empty, new rows and columns have the stretch factor 1.\n  \n  Note that upon a call to \\ref addElement, the layout is expanded automatically to contain the\n  specified row and column, using this function.\n  \n  \\see simplify\n*/\nvoid QCPLayoutGrid::expandTo(int newRowCount, int newColumnCount)\n{\n  // add rows as necessary:\n  while (rowCount() < newRowCount)\n  {\n    mElements.append(QList<QCPLayoutElement*>());\n    mRowStretchFactors.append(1);\n  }\n  // go through rows and expand columns as necessary:\n  int newColCount = qMax(columnCount(), newColumnCount);\n  for (int i=0; i<rowCount(); ++i)\n  {\n    while (mElements.at(i).size() < newColCount)\n      mElements[i].append(0);\n  }\n  while (mColumnStretchFactors.size() < newColCount)\n    mColumnStretchFactors.append(1);\n}\n\n/*!\n  Inserts a new row with empty cells at the row index \\a newIndex. Valid values for \\a newIndex\n  range from 0 (inserts a row at the top) to \\a rowCount (appends a row at the bottom).\n  \n  \\see insertColumn\n*/\nvoid QCPLayoutGrid::insertRow(int newIndex)\n{\n  if (mElements.isEmpty() || mElements.first().isEmpty()) // if grid is completely empty, add first cell\n  {\n    expandTo(1, 1);\n    return;\n  }\n  \n  if (newIndex < 0)\n    newIndex = 0;\n  if (newIndex > rowCount())\n    newIndex = rowCount();\n  \n  mRowStretchFactors.insert(newIndex, 1);\n  QList<QCPLayoutElement*> newRow;\n  for (int col=0; col<columnCount(); ++col)\n    newRow.append((QCPLayoutElement*)0);\n  mElements.insert(newIndex, newRow);\n}\n\n/*!\n  Inserts a new column with empty cells at the column index \\a newIndex. Valid values for \\a\n  newIndex range from 0 (inserts a row at the left) to \\a rowCount (appends a row at the right).\n  \n  \\see insertRow\n*/\nvoid QCPLayoutGrid::insertColumn(int newIndex)\n{\n  if (mElements.isEmpty() || mElements.first().isEmpty()) // if grid is completely empty, add first cell\n  {\n    expandTo(1, 1);\n    return;\n  }\n  \n  if (newIndex < 0)\n    newIndex = 0;\n  if (newIndex > columnCount())\n    newIndex = columnCount();\n  \n  mColumnStretchFactors.insert(newIndex, 1);\n  for (int row=0; row<rowCount(); ++row)\n    mElements[row].insert(newIndex, (QCPLayoutElement*)0);\n}\n\n/* inherits documentation from base class */\nvoid QCPLayoutGrid::updateLayout()\n{\n  QVector<int> minColWidths, minRowHeights, maxColWidths, maxRowHeights;\n  getMinimumRowColSizes(&minColWidths, &minRowHeights);\n  getMaximumRowColSizes(&maxColWidths, &maxRowHeights);\n  \n  int totalRowSpacing = (rowCount()-1) * mRowSpacing;\n  int totalColSpacing = (columnCount()-1) * mColumnSpacing;\n  QVector<int> colWidths = getSectionSizes(maxColWidths, minColWidths, mColumnStretchFactors.toVector(), mRect.width()-totalColSpacing);\n  QVector<int> rowHeights = getSectionSizes(maxRowHeights, minRowHeights, mRowStretchFactors.toVector(), mRect.height()-totalRowSpacing);\n  \n  // go through cells and set rects accordingly:\n  int yOffset = mRect.top();\n  for (int row=0; row<rowCount(); ++row)\n  {\n    if (row > 0)\n      yOffset += rowHeights.at(row-1)+mRowSpacing;\n    int xOffset = mRect.left();\n    for (int col=0; col<columnCount(); ++col)\n    {\n      if (col > 0)\n        xOffset += colWidths.at(col-1)+mColumnSpacing;\n      if (mElements.at(row).at(col))\n        mElements.at(row).at(col)->setOuterRect(QRect(xOffset, yOffset, colWidths.at(col), rowHeights.at(row)));\n    }\n  }\n}\n\n/* inherits documentation from base class */\nint QCPLayoutGrid::elementCount() const\n{\n  return rowCount()*columnCount();\n}\n\n/* inherits documentation from base class */\nQCPLayoutElement *QCPLayoutGrid::elementAt(int index) const\n{\n  if (index >= 0 && index < elementCount())\n    return mElements.at(index / columnCount()).at(index % columnCount());\n  else\n    return 0;\n}\n\n/* inherits documentation from base class */\nQCPLayoutElement *QCPLayoutGrid::takeAt(int index)\n{\n  if (QCPLayoutElement *el = elementAt(index))\n  {\n    releaseElement(el);\n    mElements[index / columnCount()][index % columnCount()] = 0;\n    return el;\n  } else\n  {\n    qDebug() << Q_FUNC_INFO << \"Attempt to take invalid index:\" << index;\n    return 0;\n  }\n}\n\n/* inherits documentation from base class */\nbool QCPLayoutGrid::take(QCPLayoutElement *element)\n{\n  if (element)\n  {\n    for (int i=0; i<elementCount(); ++i)\n    {\n      if (elementAt(i) == element)\n      {\n        takeAt(i);\n        return true;\n      }\n    }\n    qDebug() << Q_FUNC_INFO << \"Element not in this layout, couldn't take\";\n  } else\n    qDebug() << Q_FUNC_INFO << \"Can't take null element\";\n  return false;\n}\n\n/* inherits documentation from base class */\nQList<QCPLayoutElement*> QCPLayoutGrid::elements(bool recursive) const\n{\n  QList<QCPLayoutElement*> result;\n  int colC = columnCount();\n  int rowC = rowCount();\n#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)\n  result.reserve(colC*rowC);\n#endif\n  for (int row=0; row<rowC; ++row)\n  {\n    for (int col=0; col<colC; ++col)\n    {\n      result.append(mElements.at(row).at(col));\n    }\n  }\n  if (recursive)\n  {\n    int c = result.size();\n    for (int i=0; i<c; ++i)\n    {\n      if (result.at(i))\n        result << result.at(i)->elements(recursive);\n    }\n  }\n  return result;\n}\n\n/*!\n  Simplifies the layout by collapsing rows and columns which only contain empty cells.\n*/\nvoid QCPLayoutGrid::simplify()\n{\n  // remove rows with only empty cells:\n  for (int row=rowCount()-1; row>=0; --row)\n  {\n    bool hasElements = false;\n    for (int col=0; col<columnCount(); ++col)\n    {\n      if (mElements.at(row).at(col))\n      {\n        hasElements = true;\n        break;\n      }\n    }\n    if (!hasElements)\n    {\n      mRowStretchFactors.removeAt(row);\n      mElements.removeAt(row);\n      if (mElements.isEmpty()) // removed last element, also remove stretch factor (wouldn't happen below because also columnCount changed to 0 now)\n        mColumnStretchFactors.clear();\n    }\n  }\n  \n  // remove columns with only empty cells:\n  for (int col=columnCount()-1; col>=0; --col)\n  {\n    bool hasElements = false;\n    for (int row=0; row<rowCount(); ++row)\n    {\n      if (mElements.at(row).at(col))\n      {\n        hasElements = true;\n        break;\n      }\n    }\n    if (!hasElements)\n    {\n      mColumnStretchFactors.removeAt(col);\n      for (int row=0; row<rowCount(); ++row)\n        mElements[row].removeAt(col);\n    }\n  }\n}\n\n/* inherits documentation from base class */\nQSize QCPLayoutGrid::minimumSizeHint() const\n{\n  QVector<int> minColWidths, minRowHeights;\n  getMinimumRowColSizes(&minColWidths, &minRowHeights);\n  QSize result(0, 0);\n  for (int i=0; i<minColWidths.size(); ++i)\n    result.rwidth() += minColWidths.at(i);\n  for (int i=0; i<minRowHeights.size(); ++i)\n    result.rheight() += minRowHeights.at(i);\n  result.rwidth() += qMax(0, columnCount()-1) * mColumnSpacing + mMargins.left() + mMargins.right();\n  result.rheight() += qMax(0, rowCount()-1) * mRowSpacing + mMargins.top() + mMargins.bottom();\n  return result;\n}\n\n/* inherits documentation from base class */\nQSize QCPLayoutGrid::maximumSizeHint() const\n{\n  QVector<int> maxColWidths, maxRowHeights;\n  getMaximumRowColSizes(&maxColWidths, &maxRowHeights);\n  \n  QSize result(0, 0);\n  for (int i=0; i<maxColWidths.size(); ++i)\n    result.setWidth(qMin(result.width()+maxColWidths.at(i), QWIDGETSIZE_MAX));\n  for (int i=0; i<maxRowHeights.size(); ++i)\n    result.setHeight(qMin(result.height()+maxRowHeights.at(i), QWIDGETSIZE_MAX));\n  result.rwidth() += qMax(0, columnCount()-1) * mColumnSpacing + mMargins.left() + mMargins.right();\n  result.rheight() += qMax(0, rowCount()-1) * mRowSpacing + mMargins.top() + mMargins.bottom();\n  return result;\n}\n\n/*! \\internal\n  \n  Places the minimum column widths and row heights into \\a minColWidths and \\a minRowHeights\n  respectively.\n  \n  The minimum height of a row is the largest minimum height of any element in that row. The minimum\n  width of a column is the largest minimum width of any element in that column.\n  \n  This is a helper function for \\ref updateLayout.\n  \n  \\see getMaximumRowColSizes\n*/\nvoid QCPLayoutGrid::getMinimumRowColSizes(QVector<int> *minColWidths, QVector<int> *minRowHeights) const\n{\n  *minColWidths = QVector<int>(columnCount(), 0);\n  *minRowHeights = QVector<int>(rowCount(), 0);\n  for (int row=0; row<rowCount(); ++row)\n  {\n    for (int col=0; col<columnCount(); ++col)\n    {\n      if (mElements.at(row).at(col))\n      {\n        QSize minHint = mElements.at(row).at(col)->minimumSizeHint();\n        QSize min = mElements.at(row).at(col)->minimumSize();\n        QSize final(min.width() > 0 ? min.width() : minHint.width(), min.height() > 0 ? min.height() : minHint.height());\n        if (minColWidths->at(col) < final.width())\n          (*minColWidths)[col] = final.width();\n        if (minRowHeights->at(row) < final.height())\n          (*minRowHeights)[row] = final.height();\n      }\n    }\n  }\n}\n\n/*! \\internal\n  \n  Places the maximum column widths and row heights into \\a maxColWidths and \\a maxRowHeights\n  respectively.\n  \n  The maximum height of a row is the smallest maximum height of any element in that row. The\n  maximum width of a column is the smallest maximum width of any element in that column.\n  \n  This is a helper function for \\ref updateLayout.\n  \n  \\see getMinimumRowColSizes\n*/\nvoid QCPLayoutGrid::getMaximumRowColSizes(QVector<int> *maxColWidths, QVector<int> *maxRowHeights) const\n{\n  *maxColWidths = QVector<int>(columnCount(), QWIDGETSIZE_MAX);\n  *maxRowHeights = QVector<int>(rowCount(), QWIDGETSIZE_MAX);\n  for (int row=0; row<rowCount(); ++row)\n  {\n    for (int col=0; col<columnCount(); ++col)\n    {\n      if (mElements.at(row).at(col))\n      {\n        QSize maxHint = mElements.at(row).at(col)->maximumSizeHint();\n        QSize max = mElements.at(row).at(col)->maximumSize();\n        QSize final(max.width() < QWIDGETSIZE_MAX ? max.width() : maxHint.width(), max.height() < QWIDGETSIZE_MAX ? max.height() : maxHint.height());\n        if (maxColWidths->at(col) > final.width())\n          (*maxColWidths)[col] = final.width();\n        if (maxRowHeights->at(row) > final.height())\n          (*maxRowHeights)[row] = final.height();\n      }\n    }\n  }\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPLayoutInset\n////////////////////////////////////////////////////////////////////////////////////////////////////\n/*! \\class QCPLayoutInset\n  \\brief A layout that places child elements aligned to the border or arbitrarily positioned\n  \n  Elements are placed either aligned to the border or at arbitrary position in the area of the\n  layout. Which placement applies is controlled with the \\ref InsetPlacement (\\ref\n  setInsetPlacement).\n\n  Elements are added via \\ref addElement(QCPLayoutElement *element, Qt::Alignment alignment) or\n  addElement(QCPLayoutElement *element, const QRectF &rect). If the first method is used, the inset\n  placement will default to \\ref ipBorderAligned and the element will be aligned according to the\n  \\a alignment parameter. The second method defaults to \\ref ipFree and allows placing elements at\n  arbitrary position and size, defined by \\a rect.\n  \n  The alignment or rect can be set via \\ref setInsetAlignment or \\ref setInsetRect, respectively.\n  \n  This is the layout that every QCPAxisRect has as \\ref QCPAxisRect::insetLayout.\n*/\n\n/* start documentation of inline functions */\n\n/*! \\fn virtual void QCPLayoutInset::simplify()\n  \n  The QCPInsetLayout does not need simplification since it can never have empty cells due to its\n  linear index structure. This method does nothing.\n*/\n\n/* end documentation of inline functions */\n\n/*!\n  Creates an instance of QCPLayoutInset and sets default values.\n*/\nQCPLayoutInset::QCPLayoutInset()\n{\n}\n\nQCPLayoutInset::~QCPLayoutInset()\n{\n  // clear all child layout elements. This is important because only the specific layouts know how\n  // to handle removing elements (clear calls virtual removeAt method to do that).\n  clear();\n}\n\n/*!\n  Returns the placement type of the element with the specified \\a index.\n*/\nQCPLayoutInset::InsetPlacement QCPLayoutInset::insetPlacement(int index) const\n{\n  if (elementAt(index))\n    return mInsetPlacement.at(index);\n  else\n  {\n    qDebug() << Q_FUNC_INFO << \"Invalid element index:\" << index;\n    return ipFree;\n  }\n}\n\n/*!\n  Returns the alignment of the element with the specified \\a index. The alignment only has a\n  meaning, if the inset placement (\\ref setInsetPlacement) is \\ref ipBorderAligned.\n*/\nQt::Alignment QCPLayoutInset::insetAlignment(int index) const\n{\n  if (elementAt(index))\n    return mInsetAlignment.at(index);\n  else\n  {\n    qDebug() << Q_FUNC_INFO << \"Invalid element index:\" << index;\n    return 0;\n  }\n}\n\n/*!\n  Returns the rect of the element with the specified \\a index. The rect only has a\n  meaning, if the inset placement (\\ref setInsetPlacement) is \\ref ipFree.\n*/\nQRectF QCPLayoutInset::insetRect(int index) const\n{\n  if (elementAt(index))\n    return mInsetRect.at(index);\n  else\n  {\n    qDebug() << Q_FUNC_INFO << \"Invalid element index:\" << index;\n    return QRectF();\n  }\n}\n\n/*!\n  Sets the inset placement type of the element with the specified \\a index to \\a placement.\n  \n  \\see InsetPlacement\n*/\nvoid QCPLayoutInset::setInsetPlacement(int index, QCPLayoutInset::InsetPlacement placement)\n{\n  if (elementAt(index))\n    mInsetPlacement[index] = placement;\n  else\n    qDebug() << Q_FUNC_INFO << \"Invalid element index:\" << index;\n}\n\n/*!\n  If the inset placement (\\ref setInsetPlacement) is \\ref ipBorderAligned, this function\n  is used to set the alignment of the element with the specified \\a index to \\a alignment.\n  \n  \\a alignment is an or combination of the following alignment flags: Qt::AlignLeft,\n  Qt::AlignHCenter, Qt::AlighRight, Qt::AlignTop, Qt::AlignVCenter, Qt::AlignBottom. Any other\n  alignment flags will be ignored.\n*/\nvoid QCPLayoutInset::setInsetAlignment(int index, Qt::Alignment alignment)\n{\n  if (elementAt(index))\n    mInsetAlignment[index] = alignment;\n  else\n    qDebug() << Q_FUNC_INFO << \"Invalid element index:\" << index;\n}\n\n/*!\n  If the inset placement (\\ref setInsetPlacement) is \\ref ipFree, this function is used to set the\n  position and size of the element with the specified \\a index to \\a rect.\n  \n  \\a rect is given in fractions of the whole inset layout rect. So an inset with rect (0, 0, 1, 1)\n  will span the entire layout. An inset with rect (0.6, 0.1, 0.35, 0.35) will be in the top right\n  corner of the layout, with 35% width and height of the parent layout.\n  \n  Note that the minimum and maximum sizes of the embedded element (\\ref\n  QCPLayoutElement::setMinimumSize, \\ref QCPLayoutElement::setMaximumSize) are enforced.\n*/\nvoid QCPLayoutInset::setInsetRect(int index, const QRectF &rect)\n{\n  if (elementAt(index))\n    mInsetRect[index] = rect;\n  else\n    qDebug() << Q_FUNC_INFO << \"Invalid element index:\" << index;\n}\n\n/* inherits documentation from base class */\nvoid QCPLayoutInset::updateLayout()\n{\n  for (int i=0; i<mElements.size(); ++i)\n  {\n    QRect insetRect;\n    QSize finalMinSize, finalMaxSize;\n    QSize minSizeHint = mElements.at(i)->minimumSizeHint();\n    QSize maxSizeHint = mElements.at(i)->maximumSizeHint();\n    finalMinSize.setWidth(mElements.at(i)->minimumSize().width() > 0 ? mElements.at(i)->minimumSize().width() : minSizeHint.width());\n    finalMinSize.setHeight(mElements.at(i)->minimumSize().height() > 0 ? mElements.at(i)->minimumSize().height() : minSizeHint.height());\n    finalMaxSize.setWidth(mElements.at(i)->maximumSize().width() < QWIDGETSIZE_MAX ? mElements.at(i)->maximumSize().width() : maxSizeHint.width());\n    finalMaxSize.setHeight(mElements.at(i)->maximumSize().height() < QWIDGETSIZE_MAX ? mElements.at(i)->maximumSize().height() : maxSizeHint.height());\n    if (mInsetPlacement.at(i) == ipFree)\n    {\n      insetRect = QRect(rect().x()+rect().width()*mInsetRect.at(i).x(),\n                        rect().y()+rect().height()*mInsetRect.at(i).y(),\n                        rect().width()*mInsetRect.at(i).width(),\n                        rect().height()*mInsetRect.at(i).height());\n      if (insetRect.size().width() < finalMinSize.width())\n        insetRect.setWidth(finalMinSize.width());\n      if (insetRect.size().height() < finalMinSize.height())\n        insetRect.setHeight(finalMinSize.height());\n      if (insetRect.size().width() > finalMaxSize.width())\n        insetRect.setWidth(finalMaxSize.width());\n      if (insetRect.size().height() > finalMaxSize.height())\n        insetRect.setHeight(finalMaxSize.height());\n    } else if (mInsetPlacement.at(i) == ipBorderAligned)\n    {\n      insetRect.setSize(finalMinSize);\n      Qt::Alignment al = mInsetAlignment.at(i);\n      if (al.testFlag(Qt::AlignLeft)) insetRect.moveLeft(rect().x());\n      else if (al.testFlag(Qt::AlignRight)) insetRect.moveRight(rect().x()+rect().width());\n      else insetRect.moveLeft(rect().x()+rect().width()*0.5-finalMinSize.width()*0.5); // default to Qt::AlignHCenter\n      if (al.testFlag(Qt::AlignTop)) insetRect.moveTop(rect().y());\n      else if (al.testFlag(Qt::AlignBottom)) insetRect.moveBottom(rect().y()+rect().height());\n      else insetRect.moveTop(rect().y()+rect().height()*0.5-finalMinSize.height()*0.5); // default to Qt::AlignVCenter\n    }\n    mElements.at(i)->setOuterRect(insetRect);\n  }\n}\n\n/* inherits documentation from base class */\nint QCPLayoutInset::elementCount() const\n{\n  return mElements.size();\n}\n\n/* inherits documentation from base class */\nQCPLayoutElement *QCPLayoutInset::elementAt(int index) const\n{\n  if (index >= 0 && index < mElements.size())\n    return mElements.at(index);\n  else\n    return 0;\n}\n\n/* inherits documentation from base class */\nQCPLayoutElement *QCPLayoutInset::takeAt(int index)\n{\n  if (QCPLayoutElement *el = elementAt(index))\n  {\n    releaseElement(el);\n    mElements.removeAt(index);\n    mInsetPlacement.removeAt(index);\n    mInsetAlignment.removeAt(index);\n    mInsetRect.removeAt(index);\n    return el;\n  } else\n  {\n    qDebug() << Q_FUNC_INFO << \"Attempt to take invalid index:\" << index;\n    return 0;\n  }\n}\n\n/* inherits documentation from base class */\nbool QCPLayoutInset::take(QCPLayoutElement *element)\n{\n  if (element)\n  {\n    for (int i=0; i<elementCount(); ++i)\n    {\n      if (elementAt(i) == element)\n      {\n        takeAt(i);\n        return true;\n      }\n    }\n    qDebug() << Q_FUNC_INFO << \"Element not in this layout, couldn't take\";\n  } else\n    qDebug() << Q_FUNC_INFO << \"Can't take null element\";\n  return false;\n}\n\n/*!\n  The inset layout is sensitive to events only at areas where its (visible) child elements are\n  sensitive. If the selectTest method of any of the child elements returns a positive number for \\a\n  pos, this method returns a value corresponding to 0.99 times the parent plot's selection\n  tolerance. The inset layout is not selectable itself by default. So if \\a onlySelectable is true,\n  -1.0 is returned.\n  \n  See \\ref QCPLayerable::selectTest for a general explanation of this virtual method.\n*/\ndouble QCPLayoutInset::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const\n{\n  Q_UNUSED(details)\n  if (onlySelectable)\n    return -1;\n  \n  for (int i=0; i<mElements.size(); ++i)\n  {\n    // inset layout shall only return positive selectTest, if actually an inset object is at pos\n    // else it would block the entire underlying QCPAxisRect with its surface.\n    if (mElements.at(i)->realVisibility() && mElements.at(i)->selectTest(pos, onlySelectable) >= 0)\n      return mParentPlot->selectionTolerance()*0.99;\n  }\n  return -1;\n}\n\n/*!\n  Adds the specified \\a element to the layout as an inset aligned at the border (\\ref\n  setInsetAlignment is initialized with \\ref ipBorderAligned). The alignment is set to \\a\n  alignment.\n  \n  \\a alignment is an or combination of the following alignment flags: Qt::AlignLeft,\n  Qt::AlignHCenter, Qt::AlighRight, Qt::AlignTop, Qt::AlignVCenter, Qt::AlignBottom. Any other\n  alignment flags will be ignored.\n  \n  \\see addElement(QCPLayoutElement *element, const QRectF &rect)\n*/\nvoid QCPLayoutInset::addElement(QCPLayoutElement *element, Qt::Alignment alignment)\n{\n  if (element)\n  {\n    if (element->layout()) // remove from old layout first\n      element->layout()->take(element);\n    mElements.append(element);\n    mInsetPlacement.append(ipBorderAligned);\n    mInsetAlignment.append(alignment);\n    mInsetRect.append(QRectF(0.6, 0.6, 0.4, 0.4));\n    adoptElement(element);\n  } else\n    qDebug() << Q_FUNC_INFO << \"Can't add null element\";\n}\n\n/*!\n  Adds the specified \\a element to the layout as an inset with free positioning/sizing (\\ref\n  setInsetAlignment is initialized with \\ref ipFree). The position and size is set to \\a\n  rect.\n  \n  \\a rect is given in fractions of the whole inset layout rect. So an inset with rect (0, 0, 1, 1)\n  will span the entire layout. An inset with rect (0.6, 0.1, 0.35, 0.35) will be in the top right\n  corner of the layout, with 35% width and height of the parent layout.\n  \n  \\see addElement(QCPLayoutElement *element, Qt::Alignment alignment)\n*/\nvoid QCPLayoutInset::addElement(QCPLayoutElement *element, const QRectF &rect)\n{\n  if (element)\n  {\n    if (element->layout()) // remove from old layout first\n      element->layout()->take(element);\n    mElements.append(element);\n    mInsetPlacement.append(ipFree);\n    mInsetAlignment.append(Qt::AlignRight|Qt::AlignTop);\n    mInsetRect.append(rect);\n    adoptElement(element);\n  } else\n    qDebug() << Q_FUNC_INFO << \"Can't add null element\";\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPLineEnding\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPLineEnding\n  \\brief Handles the different ending decorations for line-like items\n  \n  \\image html QCPLineEnding.png \"The various ending styles currently supported\"\n  \n  For every ending a line-like item has, an instance of this class exists. For example, QCPItemLine\n  has two endings which can be set with QCPItemLine::setHead and QCPItemLine::setTail.\n \n  The styles themselves are defined via the enum QCPLineEnding::EndingStyle. Most decorations can\n  be modified regarding width and length, see \\ref setWidth and \\ref setLength. The direction of\n  the ending decoration (e.g. direction an arrow is pointing) is controlled by the line-like item.\n  For example, when both endings of a QCPItemLine are set to be arrows, they will point to opposite\n  directions, e.g. \"outward\". This can be changed by \\ref setInverted, which would make the\n  respective arrow point inward.\n  \n  Note that due to the overloaded QCPLineEnding constructor, you may directly specify a\n  QCPLineEnding::EndingStyle where actually a QCPLineEnding is expected, e.g. \\code\n  myItemLine->setHead(QCPLineEnding::esSpikeArrow) \\endcode\n*/\n\n/*!\n  Creates a QCPLineEnding instance with default values (style \\ref esNone).\n*/\nQCPLineEnding::QCPLineEnding() :\n  mStyle(esNone),\n  mWidth(8),\n  mLength(10),\n  mInverted(false)\n{\n}\n\n/*!\n  Creates a QCPLineEnding instance with the specified values.\n*/\nQCPLineEnding::QCPLineEnding(QCPLineEnding::EndingStyle style, double width, double length, bool inverted) :\n  mStyle(style),\n  mWidth(width),\n  mLength(length),\n  mInverted(inverted)\n{\n}\n\n/*!\n  Sets the style of the ending decoration.\n*/\nvoid QCPLineEnding::setStyle(QCPLineEnding::EndingStyle style)\n{\n  mStyle = style;\n}\n\n/*!\n  Sets the width of the ending decoration, if the style supports it. On arrows, for example, the\n  width defines the size perpendicular to the arrow's pointing direction.\n  \n  \\see setLength\n*/\nvoid QCPLineEnding::setWidth(double width)\n{\n  mWidth = width;\n}\n\n/*!\n  Sets the length of the ending decoration, if the style supports it. On arrows, for example, the\n  length defines the size in pointing direction.\n  \n  \\see setWidth\n*/\nvoid QCPLineEnding::setLength(double length)\n{\n  mLength = length;\n}\n\n/*!\n  Sets whether the ending decoration shall be inverted. For example, an arrow decoration will point\n  inward when \\a inverted is set to true.\n\n  Note that also the \\a width direction is inverted. For symmetrical ending styles like arrows or\n  discs, this doesn't make a difference. However, asymmetric styles like \\ref esHalfBar are\n  affected by it, which can be used to control to which side the half bar points to.\n*/\nvoid QCPLineEnding::setInverted(bool inverted)\n{\n  mInverted = inverted;\n}\n\n/*! \\internal\n  \n  Returns the maximum pixel radius the ending decoration might cover, starting from the position\n  the decoration is drawn at (typically a line ending/\\ref QCPItemPosition of an item).\n  \n  This is relevant for clipping. Only omit painting of the decoration when the position where the\n  decoration is supposed to be drawn is farther away from the clipping rect than the returned\n  distance.\n*/\ndouble QCPLineEnding::boundingDistance() const\n{\n  switch (mStyle)\n  {\n    case esNone:\n      return 0;\n      \n    case esFlatArrow:\n    case esSpikeArrow:\n    case esLineArrow:\n    case esSkewedBar:\n      return qSqrt(mWidth*mWidth+mLength*mLength); // items that have width and length\n      \n    case esDisc:\n    case esSquare:\n    case esDiamond:\n    case esBar:\n    case esHalfBar:\n      return mWidth*1.42; // items that only have a width -> width*sqrt(2)\n\n  }\n  return 0;\n}\n\n/*!\n  Starting from the origin of this line ending (which is style specific), returns the length\n  covered by the line ending symbol, in backward direction.\n  \n  For example, the \\ref esSpikeArrow has a shorter real length than a \\ref esFlatArrow, even if\n  both have the same \\ref setLength value, because the spike arrow has an inward curved back, which\n  reduces the length along its center axis (the drawing origin for arrows is at the tip).\n  \n  This function is used for precise, style specific placement of line endings, for example in\n  QCPAxes.\n*/\ndouble QCPLineEnding::realLength() const\n{\n  switch (mStyle)\n  {\n    case esNone:\n    case esLineArrow:\n    case esSkewedBar:\n    case esBar:\n    case esHalfBar:\n      return 0;\n      \n    case esFlatArrow:\n      return mLength;\n      \n    case esDisc:\n    case esSquare:\n    case esDiamond:\n      return mWidth*0.5;\n      \n    case esSpikeArrow:\n      return mLength*0.8;\n  }\n  return 0;\n}\n\n/*! \\internal\n  \n  Draws the line ending with the specified \\a painter at the position \\a pos. The direction of the\n  line ending is controlled with \\a dir.\n*/\nvoid QCPLineEnding::draw(QCPPainter *painter, const QVector2D &pos, const QVector2D &dir) const\n{\n  if (mStyle == esNone)\n    return;\n  \n  QVector2D lengthVec(dir.normalized());\n  if (lengthVec.isNull())\n    lengthVec = QVector2D(1, 0);\n  QVector2D widthVec(-lengthVec.y(), lengthVec.x());\n  lengthVec *= (float)(mLength*(mInverted ? -1 : 1));\n  widthVec *= (float)(mWidth*0.5*(mInverted ? -1 : 1));\n  \n  QPen penBackup = painter->pen();\n  QBrush brushBackup = painter->brush();\n  QPen miterPen = penBackup;\n  miterPen.setJoinStyle(Qt::MiterJoin); // to make arrow heads spikey\n  QBrush brush(painter->pen().color(), Qt::SolidPattern);\n  switch (mStyle)\n  {\n    case esNone: break;\n    case esFlatArrow:\n    {\n      QPointF points[3] = {pos.toPointF(),\n                           (pos-lengthVec+widthVec).toPointF(),\n                           (pos-lengthVec-widthVec).toPointF()\n                          };\n      painter->setPen(miterPen);\n      painter->setBrush(brush);\n      painter->drawConvexPolygon(points, 3);\n      painter->setBrush(brushBackup);\n      painter->setPen(penBackup);\n      break;\n    }\n    case esSpikeArrow:\n    {\n      QPointF points[4] = {pos.toPointF(),\n                           (pos-lengthVec+widthVec).toPointF(),\n                           (pos-lengthVec*0.8f).toPointF(),\n                           (pos-lengthVec-widthVec).toPointF()\n                          };\n      painter->setPen(miterPen);\n      painter->setBrush(brush);\n      painter->drawConvexPolygon(points, 4);\n      painter->setBrush(brushBackup);\n      painter->setPen(penBackup);\n      break;\n    }\n    case esLineArrow:\n    {\n      QPointF points[3] = {(pos-lengthVec+widthVec).toPointF(),\n                           pos.toPointF(),\n                           (pos-lengthVec-widthVec).toPointF()\n                          };\n      painter->setPen(miterPen);\n      painter->drawPolyline(points, 3);\n      painter->setPen(penBackup);\n      break;\n    }\n    case esDisc:\n    {\n      painter->setBrush(brush);\n      painter->drawEllipse(pos.toPointF(),  mWidth*0.5, mWidth*0.5);\n      painter->setBrush(brushBackup);\n      break;\n    }\n    case esSquare:\n    {\n      QVector2D widthVecPerp(-widthVec.y(), widthVec.x());\n      QPointF points[4] = {(pos-widthVecPerp+widthVec).toPointF(),\n                           (pos-widthVecPerp-widthVec).toPointF(),\n                           (pos+widthVecPerp-widthVec).toPointF(),\n                           (pos+widthVecPerp+widthVec).toPointF()\n                          };\n      painter->setPen(miterPen);\n      painter->setBrush(brush);\n      painter->drawConvexPolygon(points, 4);\n      painter->setBrush(brushBackup);\n      painter->setPen(penBackup);\n      break;\n    }\n    case esDiamond:\n    {\n      QVector2D widthVecPerp(-widthVec.y(), widthVec.x());\n      QPointF points[4] = {(pos-widthVecPerp).toPointF(),\n                           (pos-widthVec).toPointF(),\n                           (pos+widthVecPerp).toPointF(),\n                           (pos+widthVec).toPointF()\n                          };\n      painter->setPen(miterPen);\n      painter->setBrush(brush);\n      painter->drawConvexPolygon(points, 4);\n      painter->setBrush(brushBackup);\n      painter->setPen(penBackup);\n      break;\n    }\n    case esBar:\n    {\n      painter->drawLine((pos+widthVec).toPointF(), (pos-widthVec).toPointF());\n      break;\n    }\n    case esHalfBar:\n    {\n      painter->drawLine((pos+widthVec).toPointF(), pos.toPointF());\n      break;\n    }\n    case esSkewedBar:\n    {\n      if (qFuzzyIsNull(painter->pen().widthF()) && !painter->modes().testFlag(QCPPainter::pmNonCosmetic))\n      {\n        // if drawing with cosmetic pen (perfectly thin stroke, happens only in vector exports), draw bar exactly on tip of line\n        painter->drawLine((pos+widthVec+lengthVec*0.2f*(mInverted?-1:1)).toPointF(),\n                          (pos-widthVec-lengthVec*0.2f*(mInverted?-1:1)).toPointF());\n      } else\n      {\n        // if drawing with thick (non-cosmetic) pen, shift bar a little in line direction to prevent line from sticking through bar slightly\n        painter->drawLine((pos+widthVec+lengthVec*0.2f*(mInverted?-1:1)+dir.normalized()*qMax(1.0f, (float)painter->pen().widthF())*0.5f).toPointF(),\n                          (pos-widthVec-lengthVec*0.2f*(mInverted?-1:1)+dir.normalized()*qMax(1.0f, (float)painter->pen().widthF())*0.5f).toPointF());\n      }\n      break;\n    }\n  }\n}\n\n/*! \\internal\n  \\overload\n  \n  Draws the line ending. The direction is controlled with the \\a angle parameter in radians.\n*/\nvoid QCPLineEnding::draw(QCPPainter *painter, const QVector2D &pos, double angle) const\n{\n  draw(painter, pos, QVector2D(qCos(angle), qSin(angle)));\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPGrid\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPGrid\n  \\brief Responsible for drawing the grid of a QCPAxis.\n  \n  This class is tightly bound to QCPAxis. Every axis owns a grid instance and uses it to draw the\n  grid lines, sub grid lines and zero-line. You can interact with the grid of an axis via \\ref\n  QCPAxis::grid. Normally, you don't need to create an instance of QCPGrid yourself.\n  \n  The axis and grid drawing was split into two classes to allow them to be placed on different\n  layers (both QCPAxis and QCPGrid inherit from QCPLayerable). Thus it is possible to have the grid\n  in the background and the axes in the foreground, and any plottables/items in between. This\n  described situation is the default setup, see the QCPLayer documentation.\n*/\n\n/*!\n  Creates a QCPGrid instance and sets default values.\n  \n  You shouldn't instantiate grids on their own, since every QCPAxis brings its own QCPGrid.\n*/\nQCPGrid::QCPGrid(QCPAxis *parentAxis) :\n  QCPLayerable(parentAxis->parentPlot(), \"\", parentAxis),\n  mParentAxis(parentAxis)\n{\n  // warning: this is called in QCPAxis constructor, so parentAxis members should not be accessed/called\n  setParent(parentAxis);\n  setPen(QPen(QColor(200,200,200), 0, Qt::DotLine));\n  setSubGridPen(QPen(QColor(220,220,220), 0, Qt::DotLine));\n  setZeroLinePen(QPen(QColor(200,200,200), 0, Qt::SolidLine));\n  setSubGridVisible(false);\n  setAntialiased(false);\n  setAntialiasedSubGrid(false);\n  setAntialiasedZeroLine(false);\n}\n\n/*!\n  Sets whether grid lines at sub tick marks are drawn.\n  \n  \\see setSubGridPen\n*/\nvoid QCPGrid::setSubGridVisible(bool visible)\n{\n  mSubGridVisible = visible;\n}\n\n/*!\n  Sets whether sub grid lines are drawn antialiased.\n*/\nvoid QCPGrid::setAntialiasedSubGrid(bool enabled)\n{\n  mAntialiasedSubGrid = enabled;\n}\n\n/*!\n  Sets whether zero lines are drawn antialiased.\n*/\nvoid QCPGrid::setAntialiasedZeroLine(bool enabled)\n{\n  mAntialiasedZeroLine = enabled;\n}\n\n/*!\n  Sets the pen with which (major) grid lines are drawn.\n*/\nvoid QCPGrid::setPen(const QPen &pen)\n{\n  mPen = pen;\n}\n\n/*!\n  Sets the pen with which sub grid lines are drawn.\n*/\nvoid QCPGrid::setSubGridPen(const QPen &pen)\n{\n  mSubGridPen = pen;\n}\n\n/*!\n  Sets the pen with which zero lines are drawn.\n  \n  Zero lines are lines at value coordinate 0 which may be drawn with a different pen than other grid\n  lines. To disable zero lines and just draw normal grid lines at zero, set \\a pen to Qt::NoPen.\n*/\nvoid QCPGrid::setZeroLinePen(const QPen &pen)\n{\n  mZeroLinePen = pen;\n}\n\n/*! \\internal\n\n  A convenience function to easily set the QPainter::Antialiased hint on the provided \\a painter\n  before drawing the major grid lines.\n\n  This is the antialiasing state the painter passed to the \\ref draw method is in by default.\n  \n  This function takes into account the local setting of the antialiasing flag as well as the\n  overrides set with \\ref QCustomPlot::setAntialiasedElements and \\ref\n  QCustomPlot::setNotAntialiasedElements.\n  \n  \\see setAntialiased\n*/\nvoid QCPGrid::applyDefaultAntialiasingHint(QCPPainter *painter) const\n{\n  applyAntialiasingHint(painter, mAntialiased, QCP::aeGrid);\n}\n\n/*! \\internal\n  \n  Draws grid lines and sub grid lines at the positions of (sub) ticks of the parent axis, spanning\n  over the complete axis rect. Also draws the zero line, if appropriate (\\ref setZeroLinePen).\n*/\nvoid QCPGrid::draw(QCPPainter *painter)\n{\n  if (!mParentAxis) { qDebug() << Q_FUNC_INFO << \"invalid parent axis\"; return; }\n  \n  if (mSubGridVisible)\n    drawSubGridLines(painter);\n  drawGridLines(painter);\n}\n\n/*! \\internal\n  \n  Draws the main grid lines and possibly a zero line with the specified painter.\n  \n  This is a helper function called by \\ref draw.\n*/\nvoid QCPGrid::drawGridLines(QCPPainter *painter) const\n{\n  if (!mParentAxis) { qDebug() << Q_FUNC_INFO << \"invalid parent axis\"; return; }\n  \n  int lowTick = mParentAxis->mLowestVisibleTick;\n  int highTick = mParentAxis->mHighestVisibleTick;\n  double t; // helper variable, result of coordinate-to-pixel transforms\n  if (mParentAxis->orientation() == Qt::Horizontal)\n  {\n    // draw zeroline:\n    int zeroLineIndex = -1;\n    if (mZeroLinePen.style() != Qt::NoPen && mParentAxis->mRange.lower < 0 && mParentAxis->mRange.upper > 0)\n    {\n      applyAntialiasingHint(painter, mAntialiasedZeroLine, QCP::aeZeroLine);\n      painter->setPen(mZeroLinePen);\n      double epsilon = mParentAxis->range().size()*1E-6; // for comparing double to zero\n      for (int i=lowTick; i <= highTick; ++i)\n      {\n        if (qAbs(mParentAxis->mTickVector.at(i)) < epsilon)\n        {\n          zeroLineIndex = i;\n          t = mParentAxis->coordToPixel(mParentAxis->mTickVector.at(i)); // x\n          painter->drawLine(QLineF(t, mParentAxis->mAxisRect->bottom(), t, mParentAxis->mAxisRect->top()));\n          break;\n        }\n      }\n    }\n    // draw grid lines:\n    applyDefaultAntialiasingHint(painter);\n    painter->setPen(mPen);\n    for (int i=lowTick; i <= highTick; ++i)\n    {\n      if (i == zeroLineIndex) continue; // don't draw a gridline on top of the zeroline\n      t = mParentAxis->coordToPixel(mParentAxis->mTickVector.at(i)); // x\n      painter->drawLine(QLineF(t, mParentAxis->mAxisRect->bottom(), t, mParentAxis->mAxisRect->top()));\n    }\n  } else\n  {\n    // draw zeroline:\n    int zeroLineIndex = -1;\n    if (mZeroLinePen.style() != Qt::NoPen && mParentAxis->mRange.lower < 0 && mParentAxis->mRange.upper > 0)\n    {\n      applyAntialiasingHint(painter, mAntialiasedZeroLine, QCP::aeZeroLine);\n      painter->setPen(mZeroLinePen);\n      double epsilon = mParentAxis->mRange.size()*1E-6; // for comparing double to zero\n      for (int i=lowTick; i <= highTick; ++i)\n      {\n        if (qAbs(mParentAxis->mTickVector.at(i)) < epsilon)\n        {\n          zeroLineIndex = i;\n          t = mParentAxis->coordToPixel(mParentAxis->mTickVector.at(i)); // y\n          painter->drawLine(QLineF(mParentAxis->mAxisRect->left(), t, mParentAxis->mAxisRect->right(), t));\n          break;\n        }\n      }\n    }\n    // draw grid lines:\n    applyDefaultAntialiasingHint(painter);\n    painter->setPen(mPen);\n    for (int i=lowTick; i <= highTick; ++i)\n    {\n      if (i == zeroLineIndex) continue; // don't draw a gridline on top of the zeroline\n      t = mParentAxis->coordToPixel(mParentAxis->mTickVector.at(i)); // y\n      painter->drawLine(QLineF(mParentAxis->mAxisRect->left(), t, mParentAxis->mAxisRect->right(), t));\n    }\n  }\n}\n\n/*! \\internal\n  \n  Draws the sub grid lines with the specified painter.\n  \n  This is a helper function called by \\ref draw.\n*/\nvoid QCPGrid::drawSubGridLines(QCPPainter *painter) const\n{\n  if (!mParentAxis) { qDebug() << Q_FUNC_INFO << \"invalid parent axis\"; return; }\n  \n  applyAntialiasingHint(painter, mAntialiasedSubGrid, QCP::aeSubGrid);\n  double t; // helper variable, result of coordinate-to-pixel transforms\n  painter->setPen(mSubGridPen);\n  if (mParentAxis->orientation() == Qt::Horizontal)\n  {\n    for (int i=0; i<mParentAxis->mSubTickVector.size(); ++i)\n    {\n      t = mParentAxis->coordToPixel(mParentAxis->mSubTickVector.at(i)); // x\n      painter->drawLine(QLineF(t, mParentAxis->mAxisRect->bottom(), t, mParentAxis->mAxisRect->top()));\n    }\n  } else\n  {\n    for (int i=0; i<mParentAxis->mSubTickVector.size(); ++i)\n    {\n      t = mParentAxis->coordToPixel(mParentAxis->mSubTickVector.at(i)); // y\n      painter->drawLine(QLineF(mParentAxis->mAxisRect->left(), t, mParentAxis->mAxisRect->right(), t));\n    }\n  }\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPAxis\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPAxis\n  \\brief Manages a single axis inside a QCustomPlot.\n\n  Usually doesn't need to be instantiated externally. Access %QCustomPlot's default four axes via\n  QCustomPlot::xAxis (bottom), QCustomPlot::yAxis (left), QCustomPlot::xAxis2 (top) and\n  QCustomPlot::yAxis2 (right).\n  \n  Axes are always part of an axis rect, see QCPAxisRect.\n  \\image html AxisNamesOverview.png\n  <center>Naming convention of axis parts</center>\n  \\n\n    \n  \\image html AxisRectSpacingOverview.png\n  <center>Overview of the spacings and paddings that define the geometry of an axis. The dashed gray line\n  on the left represents the QCustomPlot widget border.</center>\n\n*/\n\n/* start of documentation of inline functions */\n\n/*! \\fn Qt::Orientation QCPAxis::orientation() const\n  \n  Returns the orientation of this axis. The axis orientation (horizontal or vertical) is deduced\n  from the axis type (left, top, right or bottom).\n  \n  \\see orientation(AxisType type)\n*/\n\n/*! \\fn QCPGrid *QCPAxis::grid() const\n  \n  Returns the \\ref QCPGrid instance belonging to this axis. Access it to set details about the way the\n  grid is displayed.\n*/\n\n/*! \\fn static Qt::Orientation QCPAxis::orientation(AxisType type)\n  \n  Returns the orientation of the specified axis type\n  \n  \\see orientation()\n*/\n\n/* end of documentation of inline functions */\n/* start of documentation of signals */\n\n/*! \\fn void QCPAxis::ticksRequest()\n  \n  This signal is emitted when \\ref setAutoTicks is false and the axis is about to generate tick\n  labels for a replot.\n  \n  Modifying the tick positions can be done with \\ref setTickVector. If you also want to control the\n  tick labels, set \\ref setAutoTickLabels to false and also provide the labels with \\ref\n  setTickVectorLabels.\n  \n  If you only want static ticks you probably don't need this signal, since you can just set the\n  tick vector (and possibly tick label vector) once. However, if you want to provide ticks (and\n  maybe labels) dynamically, e.g. depending on the current axis range, connect a slot to this\n  signal and set the vector/vectors there.\n*/\n\n/*! \\fn void QCPAxis::rangeChanged(const QCPRange &newRange)\n\n  This signal is emitted when the range of this axis has changed. You can connect it to the \\ref\n  setRange slot of another axis to communicate the new range to the other axis, in order for it to\n  be synchronized.\n*/\n\n/*! \\fn void QCPAxis::rangeChanged(const QCPRange &newRange, const QCPRange &oldRange)\n  \\overload\n  \n  Additionally to the new range, this signal also provides the previous range held by the axis as\n  \\a oldRange.\n*/\n\n/*! \\fn void QCPAxis::scaleTypeChanged(QCPAxis::ScaleType scaleType);\n  \n  This signal is emitted when the scale type changes, by calls to \\ref setScaleType\n*/\n\n/*! \\fn void QCPAxis::selectionChanged(QCPAxis::SelectableParts selection)\n  \n  This signal is emitted when the selection state of this axis has changed, either by user interaction\n  or by a direct call to \\ref setSelectedParts.\n*/\n\n/*! \\fn void QCPAxis::selectableChanged(const QCPAxis::SelectableParts &parts);\n  \n  This signal is emitted when the selectability changes, by calls to \\ref setSelectableParts\n*/\n\n/* end of documentation of signals */\n\n/*!\n  Constructs an Axis instance of Type \\a type for the axis rect \\a parent.\n  You shouldn't instantiate axes directly, rather use \\ref QCPAxisRect::addAxis.\n*/\nQCPAxis::QCPAxis(QCPAxisRect *parent, AxisType type) :\n  QCPLayerable(parent->parentPlot(), \"\", parent),\n  // axis base:\n  mAxisType(type),\n  mAxisRect(parent),\n  mPadding(5),\n  mOrientation(orientation(type)),\n  mSelectableParts(spAxis | spTickLabels | spAxisLabel),\n  mSelectedParts(spNone),\n  mBasePen(QPen(Qt::black, 0, Qt::SolidLine, Qt::SquareCap)),\n  mSelectedBasePen(QPen(Qt::blue, 2)),\n  // axis label:\n  mLabel(\"\"),\n  mLabelFont(mParentPlot->font()),\n  mSelectedLabelFont(QFont(mLabelFont.family(), mLabelFont.pointSize(), QFont::Bold)),\n  mLabelColor(Qt::black),\n  mSelectedLabelColor(Qt::blue),\n  // tick labels:\n  mTickLabels(true),\n  mAutoTickLabels(true),\n  mTickLabelType(ltNumber),\n  mTickLabelFont(mParentPlot->font()),\n  mSelectedTickLabelFont(QFont(mTickLabelFont.family(), mTickLabelFont.pointSize(), QFont::Bold)),\n  mTickLabelColor(Qt::black),\n  mSelectedTickLabelColor(Qt::blue),\n  mDateTimeFormat(\"hh:mm:ss\\ndd.MM.yy\"),\n  mDateTimeSpec(Qt::LocalTime),\n  mNumberPrecision(6),\n  mNumberFormatChar('g'),\n  mNumberBeautifulPowers(true),\n  // ticks and subticks:\n  mTicks(true),\n  mTickStep(1),\n  mSubTickCount(4),\n  mAutoTickCount(6),\n  mAutoTicks(true),\n  mAutoTickStep(true),\n  mAutoSubTicks(true),\n  mTickPen(QPen(Qt::black, 0, Qt::SolidLine, Qt::SquareCap)),\n  mSelectedTickPen(QPen(Qt::blue, 2)),\n  mSubTickPen(QPen(Qt::black, 0, Qt::SolidLine, Qt::SquareCap)),\n  mSelectedSubTickPen(QPen(Qt::blue, 2)),\n  // scale and range:\n  mRange(0, 5),\n  mRangeReversed(false),\n  mScaleType(stLinear),\n  mScaleLogBase(10),\n  mScaleLogBaseLogInv(1.0/qLn(mScaleLogBase)),\n  // internal members:\n  mGrid(new QCPGrid(this)),\n  mAxisPainter(new QCPAxisPainterPrivate(parent->parentPlot())),\n  mLowestVisibleTick(0),\n  mHighestVisibleTick(-1),\n  mCachedMarginValid(false),\n  mCachedMargin(0)\n{\n  mGrid->setVisible(false);\n  setAntialiased(false);\n  setLayer(mParentPlot->currentLayer()); // it's actually on that layer already, but we want it in front of the grid, so we place it on there again\n  \n  if (type == atTop)\n  {\n    setTickLabelPadding(3);\n    setLabelPadding(6);\n  } else if (type == atRight)\n  {\n    setTickLabelPadding(7);\n    setLabelPadding(12);\n  } else if (type == atBottom)\n  {\n    setTickLabelPadding(3);\n    setLabelPadding(3);\n  } else if (type == atLeft)\n  {\n    setTickLabelPadding(5);\n    setLabelPadding(10);\n  }\n}\n\nQCPAxis::~QCPAxis()\n{\n  delete mAxisPainter;\n}\n\n/* No documentation as it is a property getter */\nint QCPAxis::tickLabelPadding() const\n{\n  return mAxisPainter->tickLabelPadding;\n}\n\n/* No documentation as it is a property getter */\ndouble QCPAxis::tickLabelRotation() const\n{\n  return mAxisPainter->tickLabelRotation;\n}\n\n/* No documentation as it is a property getter */\nQString QCPAxis::numberFormat() const\n{\n  QString result;\n  result.append(mNumberFormatChar);\n  if (mNumberBeautifulPowers)\n  {\n    result.append(\"b\");\n    if (mAxisPainter->numberMultiplyCross)\n      result.append(\"c\");\n  }\n  return result;\n}\n\n/* No documentation as it is a property getter */\nint QCPAxis::tickLengthIn() const\n{\n  return mAxisPainter->tickLengthIn;\n}\n\n/* No documentation as it is a property getter */\nint QCPAxis::tickLengthOut() const\n{\n  return mAxisPainter->tickLengthOut;\n}\n\n/* No documentation as it is a property getter */\nint QCPAxis::subTickLengthIn() const\n{\n  return mAxisPainter->subTickLengthIn;\n}\n\n/* No documentation as it is a property getter */\nint QCPAxis::subTickLengthOut() const\n{\n  return mAxisPainter->subTickLengthOut;\n}\n\n/* No documentation as it is a property getter */\nint QCPAxis::labelPadding() const\n{\n  return mAxisPainter->labelPadding;\n}\n\n/* No documentation as it is a property getter */\nint QCPAxis::offset() const\n{\n  return mAxisPainter->offset;\n}\n\n/* No documentation as it is a property getter */\nQCPLineEnding QCPAxis::lowerEnding() const\n{\n  return mAxisPainter->lowerEnding;\n}\n\n/* No documentation as it is a property getter */\nQCPLineEnding QCPAxis::upperEnding() const\n{\n  return mAxisPainter->upperEnding;\n}\n\n/*!\n  Sets whether the axis uses a linear scale or a logarithmic scale. If \\a type is set to \\ref\n  stLogarithmic, the logarithm base can be set with \\ref setScaleLogBase. In logarithmic axis\n  scaling, major tick marks appear at all powers of the logarithm base. Properties like tick step\n  (\\ref setTickStep) don't apply in logarithmic scaling. If you wish a decimal base but less major\n  ticks, consider choosing a logarithm base of 100, 1000 or even higher.\n  \n  If \\a type is \\ref stLogarithmic and the number format (\\ref setNumberFormat) uses the 'b' option\n  (beautifully typeset decimal powers), the display usually is \"1 [multiplication sign] 10\n  [superscript] n\", which looks unnatural for logarithmic scaling (the \"1 [multiplication sign]\"\n  part). To only display the decimal power, set the number precision to zero with\n  \\ref setNumberPrecision.\n*/\nvoid QCPAxis::setScaleType(QCPAxis::ScaleType type)\n{\n  if (mScaleType != type)\n  {\n    mScaleType = type;\n    if (mScaleType == stLogarithmic)\n      setRange(mRange.sanitizedForLogScale());\n    mCachedMarginValid = false;\n    emit scaleTypeChanged(mScaleType);\n  }\n}\n\n/*!\n  If \\ref setScaleType is set to \\ref stLogarithmic, \\a base will be the logarithm base of the\n  scaling. In logarithmic axis scaling, major tick marks appear at all powers of \\a base.\n  \n  Properties like tick step (\\ref setTickStep) don't apply in logarithmic scaling. If you wish a decimal base but\n  less major ticks, consider choosing \\a base 100, 1000 or even higher.\n*/\nvoid QCPAxis::setScaleLogBase(double base)\n{\n  if (base > 1)\n  {\n    mScaleLogBase = base;\n    mScaleLogBaseLogInv = 1.0/qLn(mScaleLogBase); // buffer for faster baseLog() calculation\n    mCachedMarginValid = false;\n  } else\n    qDebug() << Q_FUNC_INFO << \"Invalid logarithmic scale base (must be greater 1):\" << base;\n}\n\n/*!\n  Sets the range of the axis.\n  \n  This slot may be connected with the \\ref rangeChanged signal of another axis so this axis\n  is always synchronized with the other axis range, when it changes.\n  \n  To invert the direction of an axis, use \\ref setRangeReversed.\n*/\nvoid QCPAxis::setRange(const QCPRange &range)\n{\n  if (range.lower == mRange.lower && range.upper == mRange.upper)\n    return;\n  \n  if (!QCPRange::validRange(range)) return;\n  QCPRange oldRange = mRange;\n  if (mScaleType == stLogarithmic)\n  {\n    mRange = range.sanitizedForLogScale();\n  } else\n  {\n    mRange = range.sanitizedForLinScale();\n  }\n  mCachedMarginValid = false;\n  emit rangeChanged(mRange);\n  emit rangeChanged(mRange, oldRange);\n}\n\n/*!\n  Sets whether the user can (de-)select the parts in \\a selectable by clicking on the QCustomPlot surface.\n  (When \\ref QCustomPlot::setInteractions contains iSelectAxes.)\n  \n  However, even when \\a selectable is set to a value not allowing the selection of a specific part,\n  it is still possible to set the selection of this part manually, by calling \\ref setSelectedParts\n  directly.\n  \n  \\see SelectablePart, setSelectedParts\n*/\nvoid QCPAxis::setSelectableParts(const SelectableParts &selectable)\n{\n  if (mSelectableParts != selectable)\n  {\n    mSelectableParts = selectable;\n    emit selectableChanged(mSelectableParts);\n  }\n}\n\n/*!\n  Sets the selected state of the respective axis parts described by \\ref SelectablePart. When a part\n  is selected, it uses a different pen/font.\n  \n  The entire selection mechanism for axes is handled automatically when \\ref\n  QCustomPlot::setInteractions contains iSelectAxes. You only need to call this function when you\n  wish to change the selection state manually.\n  \n  This function can change the selection state of a part, independent of the \\ref setSelectableParts setting.\n  \n  emits the \\ref selectionChanged signal when \\a selected is different from the previous selection state.\n  \n  \\see SelectablePart, setSelectableParts, selectTest, setSelectedBasePen, setSelectedTickPen, setSelectedSubTickPen,\n  setSelectedTickLabelFont, setSelectedLabelFont, setSelectedTickLabelColor, setSelectedLabelColor\n*/\nvoid QCPAxis::setSelectedParts(const SelectableParts &selected)\n{\n  if (mSelectedParts != selected)\n  {\n    mSelectedParts = selected;\n    emit selectionChanged(mSelectedParts);\n  }\n}\n\n/*!\n  \\overload\n  \n  Sets the lower and upper bound of the axis range.\n  \n  To invert the direction of an axis, use \\ref setRangeReversed.\n  \n  There is also a slot to set a range, see \\ref setRange(const QCPRange &range).\n*/\nvoid QCPAxis::setRange(double lower, double upper)\n{\n  if (lower == mRange.lower && upper == mRange.upper)\n    return;\n  \n  if (!QCPRange::validRange(lower, upper)) return;\n  QCPRange oldRange = mRange;\n  mRange.lower = lower;\n  mRange.upper = upper;\n  if (mScaleType == stLogarithmic)\n  {\n    mRange = mRange.sanitizedForLogScale();\n  } else\n  {\n    mRange = mRange.sanitizedForLinScale();\n  }\n  mCachedMarginValid = false;\n  emit rangeChanged(mRange);\n  emit rangeChanged(mRange, oldRange);\n}\n\n/*!\n  \\overload\n  \n  Sets the range of the axis.\n  \n  The \\a position coordinate indicates together with the \\a alignment parameter, where the new\n  range will be positioned. \\a size defines the size of the new axis range. \\a alignment may be\n  Qt::AlignLeft, Qt::AlignRight or Qt::AlignCenter. This will cause the left border, right border,\n  or center of the range to be aligned with \\a position. Any other values of \\a alignment will\n  default to Qt::AlignCenter.\n*/\nvoid QCPAxis::setRange(double position, double size, Qt::AlignmentFlag alignment)\n{\n  if (alignment == Qt::AlignLeft)\n    setRange(position, position+size);\n  else if (alignment == Qt::AlignRight)\n    setRange(position-size, position);\n  else // alignment == Qt::AlignCenter\n    setRange(position-size/2.0, position+size/2.0);\n}\n\n/*!\n  Sets the lower bound of the axis range. The upper bound is not changed.\n  \\see setRange\n*/\nvoid QCPAxis::setRangeLower(double lower)\n{\n  if (mRange.lower == lower)\n    return;\n  \n  QCPRange oldRange = mRange;\n  mRange.lower = lower;\n  if (mScaleType == stLogarithmic)\n  {\n    mRange = mRange.sanitizedForLogScale();\n  } else\n  {\n    mRange = mRange.sanitizedForLinScale();\n  }\n  mCachedMarginValid = false;\n  emit rangeChanged(mRange);\n  emit rangeChanged(mRange, oldRange);\n}\n\n/*!\n  Sets the upper bound of the axis range. The lower bound is not changed.\n  \\see setRange\n*/\nvoid QCPAxis::setRangeUpper(double upper)\n{\n  if (mRange.upper == upper)\n    return;\n  \n  QCPRange oldRange = mRange;\n  mRange.upper = upper;\n  if (mScaleType == stLogarithmic)\n  {\n    mRange = mRange.sanitizedForLogScale();\n  } else\n  {\n    mRange = mRange.sanitizedForLinScale();\n  }\n  mCachedMarginValid = false;\n  emit rangeChanged(mRange);\n  emit rangeChanged(mRange, oldRange);\n}\n\n/*!\n  Sets whether the axis range (direction) is displayed reversed. Normally, the values on horizontal\n  axes increase left to right, on vertical axes bottom to top. When \\a reversed is set to true, the\n  direction of increasing values is inverted.\n\n  Note that the range and data interface stays the same for reversed axes, e.g. the \\a lower part\n  of the \\ref setRange interface will still reference the mathematically smaller number than the \\a\n  upper part.\n*/\nvoid QCPAxis::setRangeReversed(bool reversed)\n{\n  if (mRangeReversed != reversed)\n  {\n    mRangeReversed = reversed;\n    mCachedMarginValid = false;\n  }\n}\n\n/*!\n  Sets whether the tick positions should be calculated automatically (either from an automatically\n  generated tick step or a tick step provided manually via \\ref setTickStep, see \\ref setAutoTickStep).\n  \n  If \\a on is set to false, you must provide the tick positions manually via \\ref setTickVector.\n  For these manual ticks you may let QCPAxis generate the appropriate labels automatically by\n  leaving \\ref setAutoTickLabels set to true. If you also wish to control the displayed labels\n  manually, set \\ref setAutoTickLabels to false and provide the label strings with \\ref\n  setTickVectorLabels.\n  \n  If you need dynamically calculated tick vectors (and possibly tick label vectors), set the\n  vectors in a slot connected to the \\ref ticksRequest signal.\n  \n  \\see setAutoTickLabels, setAutoSubTicks, setAutoTickCount, setAutoTickStep\n*/\nvoid QCPAxis::setAutoTicks(bool on)\n{\n  if (mAutoTicks != on)\n  {\n    mAutoTicks = on;\n    mCachedMarginValid = false;\n  }\n}\n\n/*!\n  When \\ref setAutoTickStep is true, \\a approximateCount determines how many ticks should be\n  generated in the visible range, approximately.\n  \n  It's not guaranteed that this number of ticks is met exactly, but approximately within a\n  tolerance of about two.\n  \n  Only values greater than zero are accepted as \\a approximateCount.\n  \n  \\see setAutoTickStep, setAutoTicks, setAutoSubTicks\n*/\nvoid QCPAxis::setAutoTickCount(int approximateCount)\n{\n  if (mAutoTickCount != approximateCount)\n  {\n    if (approximateCount > 0)\n    {\n      mAutoTickCount = approximateCount;\n      mCachedMarginValid = false;\n    } else\n      qDebug() << Q_FUNC_INFO << \"approximateCount must be greater than zero:\" << approximateCount;\n  }\n}\n\n/*!\n  Sets whether the tick labels are generated automatically. Depending on the tick label type (\\ref\n  ltNumber or \\ref ltDateTime), the labels will either show the coordinate as floating point\n  number (\\ref setNumberFormat), or a date/time formatted according to \\ref setDateTimeFormat.\n  \n  If \\a on is set to false, you should provide the tick labels via \\ref setTickVectorLabels. This\n  is usually used in a combination with \\ref setAutoTicks set to false for complete control over\n  tick positions and labels, e.g. when the ticks should be at multiples of pi and show \"2pi\", \"3pi\"\n  etc. as tick labels.\n  \n  If you need dynamically calculated tick vectors (and possibly tick label vectors), set the\n  vectors in a slot connected to the \\ref ticksRequest signal.\n  \n  \\see setAutoTicks\n*/\nvoid QCPAxis::setAutoTickLabels(bool on)\n{\n  if (mAutoTickLabels != on)\n  {\n    mAutoTickLabels = on;\n    mCachedMarginValid = false;\n  }\n}\n\n/*!\n  Sets whether the tick step, i.e. the interval between two (major) ticks, is calculated\n  automatically. If \\a on is set to true, the axis finds a tick step that is reasonable for human\n  readable plots.\n\n  The number of ticks the algorithm aims for within the visible range can be specified with \\ref\n  setAutoTickCount.\n  \n  If \\a on is set to false, you may set the tick step manually with \\ref setTickStep.\n  \n  \\see setAutoTicks, setAutoSubTicks, setAutoTickCount\n*/\nvoid QCPAxis::setAutoTickStep(bool on)\n{\n  if (mAutoTickStep != on)\n  {\n    mAutoTickStep = on;\n    mCachedMarginValid = false;\n  }\n}\n\n/*!\n  Sets whether the number of sub ticks in one tick interval is determined automatically. This\n  works, as long as the tick step mantissa is a multiple of 0.5. When \\ref setAutoTickStep is\n  enabled, this is always the case.\n  \n  When \\a on is set to false, you may set the sub tick count with \\ref setSubTickCount manually.\n  \n  \\see setAutoTickCount, setAutoTicks, setAutoTickStep\n*/\nvoid QCPAxis::setAutoSubTicks(bool on)\n{\n  if (mAutoSubTicks != on)\n  {\n    mAutoSubTicks = on;\n    mCachedMarginValid = false;\n  }\n}\n\n/*!\n  Sets whether tick marks are displayed.\n\n  Note that setting \\a show to false does not imply that tick labels are invisible, too. To achieve\n  that, see \\ref setTickLabels.\n*/\nvoid QCPAxis::setTicks(bool show)\n{\n  if (mTicks != show)\n  {\n    mTicks = show;\n    mCachedMarginValid = false;\n  }\n}\n\n/*!\n  Sets whether tick labels are displayed. Tick labels are the numbers drawn next to tick marks.\n*/\nvoid QCPAxis::setTickLabels(bool show)\n{\n  if (mTickLabels != show)\n  {\n    mTickLabels = show;\n    mCachedMarginValid = false;\n  }\n}\n\n/*!\n  Sets the distance between the axis base line (including any outward ticks) and the tick labels.\n  \\see setLabelPadding, setPadding\n*/\nvoid QCPAxis::setTickLabelPadding(int padding)\n{\n  if (mAxisPainter->tickLabelPadding != padding)\n  {\n    mAxisPainter->tickLabelPadding = padding;\n    mCachedMarginValid = false;\n  }\n}\n\n/*!\n  Sets whether the tick labels display numbers or dates/times.\n  \n  If \\a type is set to \\ref ltNumber, the format specifications of \\ref setNumberFormat apply.\n  \n  If \\a type is set to \\ref ltDateTime, the format specifications of \\ref setDateTimeFormat apply.\n  \n  In QCustomPlot, date/time coordinates are <tt>double</tt> numbers representing the seconds since\n  1970-01-01T00:00:00 UTC. This format can be retrieved from QDateTime objects with the\n  QDateTime::toTime_t() function. Since this only gives a resolution of one second, there is also\n  the QDateTime::toMSecsSinceEpoch() function which returns the timespan described above in\n  milliseconds. Divide its return value by 1000.0 to get a value with the format needed for\n  date/time plotting, with a resolution of one millisecond.\n  \n  Using the toMSecsSinceEpoch function allows dates that go back to 2nd January 4713 B.C.\n  (represented by a negative number), unlike the toTime_t function, which works with unsigned\n  integers and thus only goes back to 1st January 1970. So both for range and accuracy, use of\n  toMSecsSinceEpoch()/1000.0 should be preferred as key coordinate for date/time axes.\n  \n  \\see setTickLabels\n*/\nvoid QCPAxis::setTickLabelType(LabelType type)\n{\n  if (mTickLabelType != type)\n  {\n    mTickLabelType = type;\n    mCachedMarginValid = false;\n  }\n}\n\n/*!\n  Sets the font of the tick labels.\n  \n  \\see setTickLabels, setTickLabelColor\n*/\nvoid QCPAxis::setTickLabelFont(const QFont &font)\n{\n  if (font != mTickLabelFont)\n  {\n    mTickLabelFont = font;\n    mCachedMarginValid = false;\n  }\n}\n\n/*!\n  Sets the color of the tick labels.\n  \n  \\see setTickLabels, setTickLabelFont\n*/\nvoid QCPAxis::setTickLabelColor(const QColor &color)\n{\n  if (color != mTickLabelColor)\n  {\n    mTickLabelColor = color;\n    mCachedMarginValid = false;\n  }\n}\n\n/*!\n  Sets the rotation of the tick labels. If \\a degrees is zero, the labels are drawn normally. Else,\n  the tick labels are drawn rotated by \\a degrees clockwise. The specified angle is bound to values\n  from -90 to 90 degrees.\n  \n  If \\a degrees is exactly -90, 0 or 90, the tick labels are centered on the tick coordinate. For\n  other angles, the label is drawn with an offset such that it seems to point toward or away from\n  the tick mark.\n*/\nvoid QCPAxis::setTickLabelRotation(double degrees)\n{\n  if (!qFuzzyIsNull(degrees-mAxisPainter->tickLabelRotation))\n  {\n    mAxisPainter->tickLabelRotation = qBound(-90.0, degrees, 90.0);\n    mCachedMarginValid = false;\n  }\n}\n\n/*!\n  Sets the format in which dates and times are displayed as tick labels, if \\ref setTickLabelType is \\ref ltDateTime.\n  for details about the \\a format string, see the documentation of QDateTime::toString().\n  \n  Newlines can be inserted with \"\\n\".\n  \n  \\see setDateTimeSpec\n*/\nvoid QCPAxis::setDateTimeFormat(const QString &format)\n{\n  if (mDateTimeFormat != format)\n  {\n    mDateTimeFormat = format;\n    mCachedMarginValid = false;\n  }\n}\n\n/*!\n  Sets the time spec that is used for the date time values when \\ref setTickLabelType is \\ref\n  ltDateTime.\n\n  The default value of QDateTime objects (and also QCustomPlot) is <tt>Qt::LocalTime</tt>. However,\n  if the date time values passed to QCustomPlot are given in the UTC spec, set \\a\n  timeSpec to <tt>Qt::UTC</tt> to get the correct axis labels.\n  \n  \\see setDateTimeFormat\n*/\nvoid QCPAxis::setDateTimeSpec(const Qt::TimeSpec &timeSpec)\n{\n  mDateTimeSpec = timeSpec;\n}\n\n/*!\n  Sets the number format for the numbers drawn as tick labels (if tick label type is \\ref\n  ltNumber). This \\a formatCode is an extended version of the format code used e.g. by\n  QString::number() and QLocale::toString(). For reference about that, see the \"Argument Formats\"\n  section in the detailed description of the QString class. \\a formatCode is a string of one, two\n  or three characters. The first character is identical to the normal format code used by Qt. In\n  short, this means: 'e'/'E' scientific format, 'f' fixed format, 'g'/'G' scientific or fixed,\n  whichever is shorter.\n  \n  The second and third characters are optional and specific to QCustomPlot:\\n\n  If the first char was 'e' or 'g', numbers are/might be displayed in the scientific format, e.g.\n  \"5.5e9\", which is ugly in a plot. So when the second char of \\a formatCode is set to 'b' (for\n  \"beautiful\"), those exponential numbers are formatted in a more natural way, i.e. \"5.5\n  [multiplication sign] 10 [superscript] 9\". By default, the multiplication sign is a centered dot.\n  If instead a cross should be shown (as is usual in the USA), the third char of \\a formatCode can\n  be set to 'c'. The inserted multiplication signs are the UTF-8 characters 215 (0xD7) for the\n  cross and 183 (0xB7) for the dot.\n  \n  If the scale type (\\ref setScaleType) is \\ref stLogarithmic and the \\a formatCode uses the 'b'\n  option (beautifully typeset decimal powers), the display usually is \"1 [multiplication sign] 10\n  [superscript] n\", which looks unnatural for logarithmic scaling (the \"1 [multiplication sign]\"\n  part). To only display the decimal power, set the number precision to zero with \\ref\n  setNumberPrecision.\n  \n  Examples for \\a formatCode:\n  \\li \\c g normal format code behaviour. If number is small, fixed format is used, if number is large,\n  normal scientific format is used\n  \\li \\c gb If number is small, fixed format is used, if number is large, scientific format is used with\n  beautifully typeset decimal powers and a dot as multiplication sign\n  \\li \\c ebc All numbers are in scientific format with beautifully typeset decimal power and a cross as\n  multiplication sign\n  \\li \\c fb illegal format code, since fixed format doesn't support (or need) beautifully typeset decimal\n  powers. Format code will be reduced to 'f'.\n  \\li \\c hello illegal format code, since first char is not 'e', 'E', 'f', 'g' or 'G'. Current format\n  code will not be changed.\n*/\nvoid QCPAxis::setNumberFormat(const QString &formatCode)\n{\n  if (formatCode.isEmpty())\n  {\n    qDebug() << Q_FUNC_INFO << \"Passed formatCode is empty\";\n    return;\n  }\n  mCachedMarginValid = false;\n  \n  // interpret first char as number format char:\n  QString allowedFormatChars = \"eEfgG\";\n  if (allowedFormatChars.contains(formatCode.at(0)))\n  {\n    mNumberFormatChar = formatCode.at(0).toLatin1();\n  } else\n  {\n    qDebug() << Q_FUNC_INFO << \"Invalid number format code (first char not in 'eEfgG'):\" << formatCode;\n    return;\n  }\n  if (formatCode.length() < 2)\n  {\n    mNumberBeautifulPowers = false;\n    mAxisPainter->numberMultiplyCross = false;\n    return;\n  }\n  \n  // interpret second char as indicator for beautiful decimal powers:\n  if (formatCode.at(1) == 'b' && (mNumberFormatChar == 'e' || mNumberFormatChar == 'g'))\n  {\n    mNumberBeautifulPowers = true;\n  } else\n  {\n    qDebug() << Q_FUNC_INFO << \"Invalid number format code (second char not 'b' or first char neither 'e' nor 'g'):\" << formatCode;\n    return;\n  }\n  if (formatCode.length() < 3)\n  {\n    mAxisPainter->numberMultiplyCross = false;\n    return;\n  }\n  \n  // interpret third char as indicator for dot or cross multiplication symbol:\n  if (formatCode.at(2) == 'c')\n  {\n    mAxisPainter->numberMultiplyCross = true;\n  } else if (formatCode.at(2) == 'd')\n  {\n    mAxisPainter->numberMultiplyCross = false;\n  } else\n  {\n    qDebug() << Q_FUNC_INFO << \"Invalid number format code (third char neither 'c' nor 'd'):\" << formatCode;\n    return;\n  }\n}\n\n/*!\n  Sets the precision of the tick label numbers. See QLocale::toString(double i, char f, int prec)\n  for details. The effect of precisions are most notably for number Formats starting with 'e', see\n  \\ref setNumberFormat\n\n  If the scale type (\\ref setScaleType) is \\ref stLogarithmic and the number format (\\ref\n  setNumberFormat) uses the 'b' format code (beautifully typeset decimal powers), the display\n  usually is \"1 [multiplication sign] 10 [superscript] n\", which looks unnatural for logarithmic\n  scaling (the redundant \"1 [multiplication sign]\" part). To only display the decimal power \"10\n  [superscript] n\", set \\a precision to zero.\n*/\nvoid QCPAxis::setNumberPrecision(int precision)\n{\n  if (mNumberPrecision != precision)\n  {\n    mNumberPrecision = precision;\n    mCachedMarginValid = false;\n  }\n}\n\n/*!\n  If \\ref setAutoTickStep is set to false, use this function to set the tick step manually.\n  The tick step is the interval between (major) ticks, in plot coordinates.\n  \\see setSubTickCount\n*/\nvoid QCPAxis::setTickStep(double step)\n{\n  if (mTickStep != step)\n  {\n    mTickStep = step;\n    mCachedMarginValid = false;\n  }\n}\n\n/*!\n  If you want full control over what ticks (and possibly labels) the axes show, this function is\n  used to set the coordinates at which ticks will appear.\\ref setAutoTicks must be disabled, else\n  the provided tick vector will be overwritten with automatically generated tick coordinates upon\n  replot. The labels of the ticks can be generated automatically when \\ref setAutoTickLabels is\n  left enabled. If it is disabled, you can set the labels manually with \\ref setTickVectorLabels.\n  \n  \\a vec is a vector containing the positions of the ticks, in plot coordinates.\n  \n  \\warning \\a vec must be sorted in ascending order, no additional checks are made to ensure this.\n\n  \\see setTickVectorLabels\n*/\nvoid QCPAxis::setTickVector(const QVector<double> &vec)\n{\n  // don't check whether mTickVector != vec here, because it takes longer than we would save\n  mTickVector = vec;\n  mCachedMarginValid = false;\n}\n\n/*!\n  If you want full control over what ticks and labels the axes show, this function is used to set a\n  number of QStrings that will be displayed at the tick positions which you need to provide with\n  \\ref setTickVector. These two vectors should have the same size. (Note that you need to disable\n  \\ref setAutoTicks and \\ref setAutoTickLabels first.)\n  \n  \\a vec is a vector containing the labels of the ticks. The entries correspond to the respective\n  indices in the tick vector, passed via \\ref setTickVector.\n  \n  \\see setTickVector\n*/\nvoid QCPAxis::setTickVectorLabels(const QVector<QString> &vec)\n{\n  // don't check whether mTickVectorLabels != vec here, because it takes longer than we would save\n  mTickVectorLabels = vec;\n  mCachedMarginValid = false;\n}\n\n/*!\n  Sets the length of the ticks in pixels. \\a inside is the length the ticks will reach inside the\n  plot and \\a outside is the length they will reach outside the plot. If \\a outside is greater than\n  zero, the tick labels and axis label will increase their distance to the axis accordingly, so\n  they won't collide with the ticks.\n  \n  \\see setSubTickLength, setTickLengthIn, setTickLengthOut\n*/\nvoid QCPAxis::setTickLength(int inside, int outside)\n{\n  setTickLengthIn(inside);\n  setTickLengthOut(outside);\n}\n\n/*!\n  Sets the length of the inward ticks in pixels. \\a inside is the length the ticks will reach\n  inside the plot.\n  \n  \\see setTickLengthOut, setTickLength, setSubTickLength\n*/\nvoid QCPAxis::setTickLengthIn(int inside)\n{\n  if (mAxisPainter->tickLengthIn != inside)\n  {\n    mAxisPainter->tickLengthIn = inside;\n  }\n}\n\n/*!\n  Sets the length of the outward ticks in pixels. \\a outside is the length the ticks will reach\n  outside the plot. If \\a outside is greater than zero, the tick labels and axis label will\n  increase their distance to the axis accordingly, so they won't collide with the ticks.\n  \n  \\see setTickLengthIn, setTickLength, setSubTickLength\n*/\nvoid QCPAxis::setTickLengthOut(int outside)\n{\n  if (mAxisPainter->tickLengthOut != outside)\n  {\n    mAxisPainter->tickLengthOut = outside;\n    mCachedMarginValid = false; // only outside tick length can change margin\n  }\n}\n\n/*!\n  Sets the number of sub ticks in one (major) tick step. A sub tick count of three for example,\n  divides the tick intervals in four sub intervals.\n  \n  By default, the number of sub ticks is chosen automatically in a reasonable manner as long as the\n  mantissa of the tick step is a multiple of 0.5. When \\ref setAutoTickStep is enabled, this is\n  always the case.\n\n  If you want to disable automatic sub tick count and use this function to set the count manually,\n  see \\ref setAutoSubTicks.\n*/\nvoid QCPAxis::setSubTickCount(int count)\n{\n  mSubTickCount = count;\n}\n\n/*!\n  Sets the length of the subticks in pixels. \\a inside is the length the subticks will reach inside\n  the plot and \\a outside is the length they will reach outside the plot. If \\a outside is greater\n  than zero, the tick labels and axis label will increase their distance to the axis accordingly,\n  so they won't collide with the ticks.\n  \n  \\see setTickLength, setSubTickLengthIn, setSubTickLengthOut\n*/\nvoid QCPAxis::setSubTickLength(int inside, int outside)\n{\n  setSubTickLengthIn(inside);\n  setSubTickLengthOut(outside);\n}\n\n/*!\n  Sets the length of the inward subticks in pixels. \\a inside is the length the subticks will reach inside\n  the plot.\n  \n  \\see setSubTickLengthOut, setSubTickLength, setTickLength\n*/\nvoid QCPAxis::setSubTickLengthIn(int inside)\n{\n  if (mAxisPainter->subTickLengthIn != inside)\n  {\n    mAxisPainter->subTickLengthIn = inside;\n  }\n}\n\n/*!\n  Sets the length of the outward subticks in pixels. \\a outside is the length the subticks will reach\n  outside the plot. If \\a outside is greater than zero, the tick labels will increase their\n  distance to the axis accordingly, so they won't collide with the ticks.\n  \n  \\see setSubTickLengthIn, setSubTickLength, setTickLength\n*/\nvoid QCPAxis::setSubTickLengthOut(int outside)\n{\n  if (mAxisPainter->subTickLengthOut != outside)\n  {\n    mAxisPainter->subTickLengthOut = outside;\n    mCachedMarginValid = false; // only outside tick length can change margin\n  }\n}\n\n/*!\n  Sets the pen, the axis base line is drawn with.\n  \n  \\see setTickPen, setSubTickPen\n*/\nvoid QCPAxis::setBasePen(const QPen &pen)\n{\n  mBasePen = pen;\n}\n\n/*!\n  Sets the pen, tick marks will be drawn with.\n  \n  \\see setTickLength, setBasePen\n*/\nvoid QCPAxis::setTickPen(const QPen &pen)\n{\n  mTickPen = pen;\n}\n\n/*!\n  Sets the pen, subtick marks will be drawn with.\n  \n  \\see setSubTickCount, setSubTickLength, setBasePen\n*/\nvoid QCPAxis::setSubTickPen(const QPen &pen)\n{\n  mSubTickPen = pen;\n}\n\n/*!\n  Sets the font of the axis label.\n  \n  \\see setLabelColor\n*/\nvoid QCPAxis::setLabelFont(const QFont &font)\n{\n  if (mLabelFont != font)\n  {\n    mLabelFont = font;\n    mCachedMarginValid = false;\n  }\n}\n\n/*!\n  Sets the color of the axis label.\n  \n  \\see setLabelFont\n*/\nvoid QCPAxis::setLabelColor(const QColor &color)\n{\n  mLabelColor = color;\n}\n\n/*!\n  Sets the text of the axis label that will be shown below/above or next to the axis, depending on\n  its orientation. To disable axis labels, pass an empty string as \\a str.\n*/\nvoid QCPAxis::setLabel(const QString &str)\n{\n  if (mLabel != str)\n  {\n    mLabel = str;\n    mCachedMarginValid = false;\n  }\n}\n\n/*!\n  Sets the distance between the tick labels and the axis label.\n  \n  \\see setTickLabelPadding, setPadding\n*/\nvoid QCPAxis::setLabelPadding(int padding)\n{\n  if (mAxisPainter->labelPadding != padding)\n  {\n    mAxisPainter->labelPadding = padding;\n    mCachedMarginValid = false;\n  }\n}\n\n/*!\n  Sets the padding of the axis.\n\n  When \\ref QCPAxisRect::setAutoMargins is enabled, the padding is the additional outer most space,\n  that is left blank.\n  \n  The axis padding has no meaning if \\ref QCPAxisRect::setAutoMargins is disabled.\n  \n  \\see setLabelPadding, setTickLabelPadding\n*/\nvoid QCPAxis::setPadding(int padding)\n{\n  if (mPadding != padding)\n  {\n    mPadding = padding;\n    mCachedMarginValid = false;\n  }\n}\n\n/*!\n  Sets the offset the axis has to its axis rect side.\n  \n  If an axis rect side has multiple axes and automatic margin calculation is enabled for that side,\n  only the offset of the inner most axis has meaning (even if it is set to be invisible). The\n  offset of the other, outer axes is controlled automatically, to place them at appropriate\n  positions.\n*/\nvoid QCPAxis::setOffset(int offset)\n{\n  mAxisPainter->offset = offset;\n}\n\n/*!\n  Sets the font that is used for tick labels when they are selected.\n  \n  \\see setTickLabelFont, setSelectableParts, setSelectedParts, QCustomPlot::setInteractions\n*/\nvoid QCPAxis::setSelectedTickLabelFont(const QFont &font)\n{\n  if (font != mSelectedTickLabelFont)\n  {\n    mSelectedTickLabelFont = font;\n    // don't set mCachedMarginValid to false here because margin calculation is always done with non-selected fonts\n  }\n}\n\n/*!\n  Sets the font that is used for the axis label when it is selected.\n  \n  \\see setLabelFont, setSelectableParts, setSelectedParts, QCustomPlot::setInteractions\n*/\nvoid QCPAxis::setSelectedLabelFont(const QFont &font)\n{\n  mSelectedLabelFont = font;\n  // don't set mCachedMarginValid to false here because margin calculation is always done with non-selected fonts\n}\n\n/*!\n  Sets the color that is used for tick labels when they are selected.\n  \n  \\see setTickLabelColor, setSelectableParts, setSelectedParts, QCustomPlot::setInteractions\n*/\nvoid QCPAxis::setSelectedTickLabelColor(const QColor &color)\n{\n  if (color != mSelectedTickLabelColor)\n  {\n    mSelectedTickLabelColor = color;\n  }\n}\n\n/*!\n  Sets the color that is used for the axis label when it is selected.\n  \n  \\see setLabelColor, setSelectableParts, setSelectedParts, QCustomPlot::setInteractions\n*/\nvoid QCPAxis::setSelectedLabelColor(const QColor &color)\n{\n  mSelectedLabelColor = color;\n}\n\n/*!\n  Sets the pen that is used to draw the axis base line when selected.\n  \n  \\see setBasePen, setSelectableParts, setSelectedParts, QCustomPlot::setInteractions\n*/\nvoid QCPAxis::setSelectedBasePen(const QPen &pen)\n{\n  mSelectedBasePen = pen;\n}\n\n/*!\n  Sets the pen that is used to draw the (major) ticks when selected.\n  \n  \\see setTickPen, setSelectableParts, setSelectedParts, QCustomPlot::setInteractions\n*/\nvoid QCPAxis::setSelectedTickPen(const QPen &pen)\n{\n  mSelectedTickPen = pen;\n}\n\n/*!\n  Sets the pen that is used to draw the subticks when selected.\n  \n  \\see setSubTickPen, setSelectableParts, setSelectedParts, QCustomPlot::setInteractions\n*/\nvoid QCPAxis::setSelectedSubTickPen(const QPen &pen)\n{\n  mSelectedSubTickPen = pen;\n}\n\n/*!\n  Sets the style for the lower axis ending. See the documentation of QCPLineEnding for available\n  styles.\n  \n  For horizontal axes, this method refers to the left ending, for vertical axes the bottom ending.\n  Note that this meaning does not change when the axis range is reversed with \\ref\n  setRangeReversed.\n  \n  \\see setUpperEnding\n*/\nvoid QCPAxis::setLowerEnding(const QCPLineEnding &ending)\n{\n  mAxisPainter->lowerEnding = ending;\n}\n\n/*!\n  Sets the style for the upper axis ending. See the documentation of QCPLineEnding for available\n  styles.\n  \n  For horizontal axes, this method refers to the right ending, for vertical axes the top ending.\n  Note that this meaning does not change when the axis range is reversed with \\ref\n  setRangeReversed.\n  \n  \\see setLowerEnding\n*/\nvoid QCPAxis::setUpperEnding(const QCPLineEnding &ending)\n{\n  mAxisPainter->upperEnding = ending;\n}\n\n/*!\n  If the scale type (\\ref setScaleType) is \\ref stLinear, \\a diff is added to the lower and upper\n  bounds of the range. The range is simply moved by \\a diff.\n  \n  If the scale type is \\ref stLogarithmic, the range bounds are multiplied by \\a diff. This\n  corresponds to an apparent \"linear\" move in logarithmic scaling by a distance of log(diff).\n*/\nvoid QCPAxis::moveRange(double diff)\n{\n  QCPRange oldRange = mRange;\n  if (mScaleType == stLinear)\n  {\n    mRange.lower += diff;\n    mRange.upper += diff;\n  } else // mScaleType == stLogarithmic\n  {\n    mRange.lower *= diff;\n    mRange.upper *= diff;\n  }\n  mCachedMarginValid = false;\n  emit rangeChanged(mRange);\n  emit rangeChanged(mRange, oldRange);\n}\n\n/*!\n  Scales the range of this axis by \\a factor around the coordinate \\a center. For example, if \\a\n  factor is 2.0, \\a center is 1.0, then the axis range will double its size, and the point at\n  coordinate 1.0 won't have changed its position in the QCustomPlot widget (i.e. coordinates\n  around 1.0 will have moved symmetrically closer to 1.0).\n*/\nvoid QCPAxis::scaleRange(double factor, double center)\n{\n  QCPRange oldRange = mRange;\n  if (mScaleType == stLinear)\n  {\n    QCPRange newRange;\n    newRange.lower = (mRange.lower-center)*factor + center;\n    newRange.upper = (mRange.upper-center)*factor + center;\n    if (QCPRange::validRange(newRange))\n      mRange = newRange.sanitizedForLinScale();\n  } else // mScaleType == stLogarithmic\n  {\n    if ((mRange.upper < 0 && center < 0) || (mRange.upper > 0 && center > 0)) // make sure center has same sign as range\n    {\n      QCPRange newRange;\n      newRange.lower = pow(mRange.lower/center, factor)*center;\n      newRange.upper = pow(mRange.upper/center, factor)*center;\n      if (QCPRange::validRange(newRange))\n        mRange = newRange.sanitizedForLogScale();\n    } else\n      qDebug() << Q_FUNC_INFO << \"Center of scaling operation doesn't lie in same logarithmic sign domain as range:\" << center;\n  }\n  mCachedMarginValid = false;\n  emit rangeChanged(mRange);\n  emit rangeChanged(mRange, oldRange);\n}\n\n/*!\n  Scales the range of this axis to have a certain scale \\a ratio to \\a otherAxis. The scaling will\n  be done around the center of the current axis range.\n\n  For example, if \\a ratio is 1, this axis is the \\a yAxis and \\a otherAxis is \\a xAxis, graphs\n  plotted with those axes will appear in a 1:1 aspect ratio, independent of the aspect ratio the\n  axis rect has.\n\n  This is an operation that changes the range of this axis once, it doesn't fix the scale ratio\n  indefinitely. Note that calling this function in the constructor of the QCustomPlot's parent\n  won't have the desired effect, since the widget dimensions aren't defined yet, and a resizeEvent\n  will follow.\n*/\nvoid QCPAxis::setScaleRatio(const QCPAxis *otherAxis, double ratio)\n{\n  int otherPixelSize, ownPixelSize;\n  \n  if (otherAxis->orientation() == Qt::Horizontal)\n    otherPixelSize = otherAxis->axisRect()->width();\n  else\n    otherPixelSize = otherAxis->axisRect()->height();\n  \n  if (orientation() == Qt::Horizontal)\n    ownPixelSize = axisRect()->width();\n  else\n    ownPixelSize = axisRect()->height();\n  \n  double newRangeSize = ratio*otherAxis->range().size()*ownPixelSize/(double)otherPixelSize;\n  setRange(range().center(), newRangeSize, Qt::AlignCenter);\n}\n\n/*!\n  Changes the axis range such that all plottables associated with this axis are fully visible in\n  that dimension.\n  \n  \\see QCPAbstractPlottable::rescaleAxes, QCustomPlot::rescaleAxes\n*/\nvoid QCPAxis::rescale(bool onlyVisiblePlottables)\n{\n  QList<QCPAbstractPlottable*> p = plottables();\n  QCPRange newRange;\n  bool haveRange = false;\n  for (int i=0; i<p.size(); ++i)\n  {\n    if (!p.at(i)->realVisibility() && onlyVisiblePlottables)\n      continue;\n    QCPRange plottableRange;\n    bool currentFoundRange;\n    QCPAbstractPlottable::SignDomain signDomain = QCPAbstractPlottable::sdBoth;\n    if (mScaleType == stLogarithmic)\n      signDomain = (mRange.upper < 0 ? QCPAbstractPlottable::sdNegative : QCPAbstractPlottable::sdPositive);\n    if (p.at(i)->keyAxis() == this)\n      plottableRange = p.at(i)->getKeyRange(currentFoundRange, signDomain);\n    else\n      plottableRange = p.at(i)->getValueRange(currentFoundRange, signDomain);\n    if (currentFoundRange)\n    {\n      if (!haveRange)\n        newRange = plottableRange;\n      else\n        newRange.expand(plottableRange);\n      haveRange = true;\n    }\n  }\n  if (haveRange)\n  {\n    if (!QCPRange::validRange(newRange)) // likely due to range being zero (plottable has only constant data in this axis dimension), shift current range to at least center the plottable\n    {\n      double center = (newRange.lower+newRange.upper)*0.5; // upper and lower should be equal anyway, but just to make sure, incase validRange returned false for other reason\n      if (mScaleType == stLinear)\n      {\n        newRange.lower = center-mRange.size()/2.0;\n        newRange.upper = center+mRange.size()/2.0;\n      } else // mScaleType == stLogarithmic\n      {\n        newRange.lower = center/qSqrt(mRange.upper/mRange.lower);\n        newRange.upper = center*qSqrt(mRange.upper/mRange.lower);\n      }\n    }\n    setRange(newRange);\n  }\n}\n\n/*!\n  Transforms \\a value, in pixel coordinates of the QCustomPlot widget, to axis coordinates.\n*/\ndouble QCPAxis::pixelToCoord(double value) const\n{\n  if (orientation() == Qt::Horizontal)\n  {\n    if (mScaleType == stLinear)\n    {\n      if (!mRangeReversed)\n        return (value-mAxisRect->left())/(double)mAxisRect->width()*mRange.size()+mRange.lower;\n      else\n        return -(value-mAxisRect->left())/(double)mAxisRect->width()*mRange.size()+mRange.upper;\n    } else // mScaleType == stLogarithmic\n    {\n      if (!mRangeReversed)\n        return pow(mRange.upper/mRange.lower, (value-mAxisRect->left())/(double)mAxisRect->width())*mRange.lower;\n      else\n        return pow(mRange.upper/mRange.lower, (mAxisRect->left()-value)/(double)mAxisRect->width())*mRange.upper;\n    }\n  } else // orientation() == Qt::Vertical\n  {\n    if (mScaleType == stLinear)\n    {\n      if (!mRangeReversed)\n        return (mAxisRect->bottom()-value)/(double)mAxisRect->height()*mRange.size()+mRange.lower;\n      else\n        return -(mAxisRect->bottom()-value)/(double)mAxisRect->height()*mRange.size()+mRange.upper;\n    } else // mScaleType == stLogarithmic\n    {\n      if (!mRangeReversed)\n        return pow(mRange.upper/mRange.lower, (mAxisRect->bottom()-value)/(double)mAxisRect->height())*mRange.lower;\n      else\n        return pow(mRange.upper/mRange.lower, (value-mAxisRect->bottom())/(double)mAxisRect->height())*mRange.upper;\n    }\n  }\n}\n\n/*!\n  Transforms \\a value, in coordinates of the axis, to pixel coordinates of the QCustomPlot widget.\n*/\ndouble QCPAxis::coordToPixel(double value) const\n{\n  if (orientation() == Qt::Horizontal)\n  {\n    if (mScaleType == stLinear)\n    {\n      if (!mRangeReversed)\n        return (value-mRange.lower)/mRange.size()*mAxisRect->width()+mAxisRect->left();\n      else\n        return (mRange.upper-value)/mRange.size()*mAxisRect->width()+mAxisRect->left();\n    } else // mScaleType == stLogarithmic\n    {\n      if (value >= 0 && mRange.upper < 0) // invalid value for logarithmic scale, just draw it outside visible range\n        return !mRangeReversed ? mAxisRect->right()+200 : mAxisRect->left()-200;\n      else if (value <= 0 && mRange.upper > 0) // invalid value for logarithmic scale, just draw it outside visible range\n        return !mRangeReversed ? mAxisRect->left()-200 : mAxisRect->right()+200;\n      else\n      {\n        if (!mRangeReversed)\n          return baseLog(value/mRange.lower)/baseLog(mRange.upper/mRange.lower)*mAxisRect->width()+mAxisRect->left();\n        else\n          return baseLog(mRange.upper/value)/baseLog(mRange.upper/mRange.lower)*mAxisRect->width()+mAxisRect->left();\n      }\n    }\n  } else // orientation() == Qt::Vertical\n  {\n    if (mScaleType == stLinear)\n    {\n      if (!mRangeReversed)\n        return mAxisRect->bottom()-(value-mRange.lower)/mRange.size()*mAxisRect->height();\n      else\n        return mAxisRect->bottom()-(mRange.upper-value)/mRange.size()*mAxisRect->height();\n    } else // mScaleType == stLogarithmic\n    {\n      if (value >= 0 && mRange.upper < 0) // invalid value for logarithmic scale, just draw it outside visible range\n        return !mRangeReversed ? mAxisRect->top()-200 : mAxisRect->bottom()+200;\n      else if (value <= 0 && mRange.upper > 0) // invalid value for logarithmic scale, just draw it outside visible range\n        return !mRangeReversed ? mAxisRect->bottom()+200 : mAxisRect->top()-200;\n      else\n      {\n        if (!mRangeReversed)\n          return mAxisRect->bottom()-baseLog(value/mRange.lower)/baseLog(mRange.upper/mRange.lower)*mAxisRect->height();\n        else\n          return mAxisRect->bottom()-baseLog(mRange.upper/value)/baseLog(mRange.upper/mRange.lower)*mAxisRect->height();\n      }\n    }\n  }\n}\n\n/*!\n  Returns the part of the axis that is hit by \\a pos (in pixels). The return value of this function\n  is independent of the user-selectable parts defined with \\ref setSelectableParts. Further, this\n  function does not change the current selection state of the axis.\n  \n  If the axis is not visible (\\ref setVisible), this function always returns \\ref spNone.\n  \n  \\see setSelectedParts, setSelectableParts, QCustomPlot::setInteractions\n*/\nQCPAxis::SelectablePart QCPAxis::getPartAt(const QPointF &pos) const\n{\n  if (!mVisible)\n    return spNone;\n  \n  if (mAxisPainter->axisSelectionBox().contains(pos.toPoint()))\n    return spAxis;\n  else if (mAxisPainter->tickLabelsSelectionBox().contains(pos.toPoint()))\n    return spTickLabels;\n  else if (mAxisPainter->labelSelectionBox().contains(pos.toPoint()))\n    return spAxisLabel;\n  else\n    return spNone;\n}\n\n/* inherits documentation from base class */\ndouble QCPAxis::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const\n{\n  if (!mParentPlot) return -1;\n  SelectablePart part = getPartAt(pos);\n  if ((onlySelectable && !mSelectableParts.testFlag(part)) || part == spNone)\n    return -1;\n  \n  if (details)\n    details->setValue(part);\n  return mParentPlot->selectionTolerance()*0.99;\n}\n\n/*!\n  Returns a list of all the plottables that have this axis as key or value axis.\n  \n  If you are only interested in plottables of type QCPGraph, see \\ref graphs.\n  \n  \\see graphs, items\n*/\nQList<QCPAbstractPlottable*> QCPAxis::plottables() const\n{\n  QList<QCPAbstractPlottable*> result;\n  if (!mParentPlot) return result;\n  \n  for (int i=0; i<mParentPlot->mPlottables.size(); ++i)\n  {\n    if (mParentPlot->mPlottables.at(i)->keyAxis() == this ||mParentPlot->mPlottables.at(i)->valueAxis() == this)\n      result.append(mParentPlot->mPlottables.at(i));\n  }\n  return result;\n}\n\n/*!\n  Returns a list of all the graphs that have this axis as key or value axis.\n  \n  \\see plottables, items\n*/\nQList<QCPGraph*> QCPAxis::graphs() const\n{\n  QList<QCPGraph*> result;\n  if (!mParentPlot) return result;\n  \n  for (int i=0; i<mParentPlot->mGraphs.size(); ++i)\n  {\n    if (mParentPlot->mGraphs.at(i)->keyAxis() == this || mParentPlot->mGraphs.at(i)->valueAxis() == this)\n      result.append(mParentPlot->mGraphs.at(i));\n  }\n  return result;\n}\n\n/*!\n  Returns a list of all the items that are associated with this axis. An item is considered\n  associated with an axis if at least one of its positions uses the axis as key or value axis.\n  \n  \\see plottables, graphs\n*/\nQList<QCPAbstractItem*> QCPAxis::items() const\n{\n  QList<QCPAbstractItem*> result;\n  if (!mParentPlot) return result;\n  \n  for (int itemId=0; itemId<mParentPlot->mItems.size(); ++itemId)\n  {\n    QList<QCPItemPosition*> positions = mParentPlot->mItems.at(itemId)->positions();\n    for (int posId=0; posId<positions.size(); ++posId)\n    {\n      if (positions.at(posId)->keyAxis() == this || positions.at(posId)->valueAxis() == this)\n      {\n        result.append(mParentPlot->mItems.at(itemId));\n        break;\n      }\n    }\n  }\n  return result;\n}\n\n/*!\n  Transforms a margin side to the logically corresponding axis type. (QCP::msLeft to\n  QCPAxis::atLeft, QCP::msRight to QCPAxis::atRight, etc.)\n*/\nQCPAxis::AxisType QCPAxis::marginSideToAxisType(QCP::MarginSide side)\n{\n  switch (side)\n  {\n    case QCP::msLeft: return atLeft;\n    case QCP::msRight: return atRight;\n    case QCP::msTop: return atTop;\n    case QCP::msBottom: return atBottom;\n    default: break;\n  }\n  qDebug() << Q_FUNC_INFO << \"Invalid margin side passed:\" << (int)side;\n  return atLeft;\n}\n\n/*!\n  Returns the axis type that describes the opposite axis of an axis with the specified \\a type.\n*/\nQCPAxis::AxisType QCPAxis::opposite(QCPAxis::AxisType type)\n{\n  switch (type)\n  {\n    case atLeft: return atRight; break;\n    case atRight: return atLeft; break;\n    case atBottom: return atTop; break;\n    case atTop: return atBottom; break;\n    default: qDebug() << Q_FUNC_INFO << \"invalid axis type\"; return atLeft; break;\n  }\n}\n\n/*! \\internal\n  \n  This function is called to prepare the tick vector, sub tick vector and tick label vector. If\n  \\ref setAutoTicks is set to true, appropriate tick values are determined automatically via \\ref\n  generateAutoTicks. If it's set to false, the signal ticksRequest is emitted, which can be used to\n  provide external tick positions. Then the sub tick vectors and tick label vectors are created.\n*/\nvoid QCPAxis::setupTickVectors()\n{\n  if (!mParentPlot) return;\n  if ((!mTicks && !mTickLabels && !mGrid->visible()) || mRange.size() <= 0) return;\n  \n  // fill tick vectors, either by auto generating or by notifying user to fill the vectors himself\n  if (mAutoTicks)\n  {\n    generateAutoTicks();\n  } else\n  {\n    emit ticksRequest();\n  }\n  \n  visibleTickBounds(mLowestVisibleTick, mHighestVisibleTick);\n  if (mTickVector.isEmpty())\n  {\n    mSubTickVector.clear();\n    return;\n  }\n  \n  // generate subticks between ticks:\n  mSubTickVector.resize((mTickVector.size()-1)*mSubTickCount);\n  if (mSubTickCount > 0)\n  {\n    double subTickStep = 0;\n    double subTickPosition = 0;\n    int subTickIndex = 0;\n    bool done = false;\n    int lowTick = mLowestVisibleTick > 0 ? mLowestVisibleTick-1 : mLowestVisibleTick;\n    int highTick = mHighestVisibleTick < mTickVector.size()-1 ? mHighestVisibleTick+1 : mHighestVisibleTick;\n    for (int i=lowTick+1; i<=highTick; ++i)\n    {\n      subTickStep = (mTickVector.at(i)-mTickVector.at(i-1))/(double)(mSubTickCount+1);\n      for (int k=1; k<=mSubTickCount; ++k)\n      {\n        subTickPosition = mTickVector.at(i-1) + k*subTickStep;\n        if (subTickPosition < mRange.lower)\n          continue;\n        if (subTickPosition > mRange.upper)\n        {\n          done = true;\n          break;\n        }\n        mSubTickVector[subTickIndex] = subTickPosition;\n        subTickIndex++;\n      }\n      if (done) break;\n    }\n    mSubTickVector.resize(subTickIndex);\n  }\n\n  // generate tick labels according to tick positions:\n  if (mAutoTickLabels)\n  {\n    int vecsize = mTickVector.size();\n    mTickVectorLabels.resize(vecsize);\n    if (mTickLabelType == ltNumber)\n    {\n      for (int i=mLowestVisibleTick; i<=mHighestVisibleTick; ++i)\n        mTickVectorLabels[i] = mParentPlot->locale().toString(mTickVector.at(i), mNumberFormatChar, mNumberPrecision);\n    } else if (mTickLabelType == ltDateTime)\n    {\n      for (int i=mLowestVisibleTick; i<=mHighestVisibleTick; ++i)\n      {\n#if QT_VERSION < QT_VERSION_CHECK(4, 7, 0) // use fromMSecsSinceEpoch function if available, to gain sub-second accuracy on tick labels (e.g. for format \"hh:mm:ss:zzz\")\n        mTickVectorLabels[i] = mParentPlot->locale().toString(QDateTime::fromTime_t(mTickVector.at(i)).toTimeSpec(mDateTimeSpec), mDateTimeFormat);\n#else\n        mTickVectorLabels[i] = mParentPlot->locale().toString(QDateTime::fromMSecsSinceEpoch(mTickVector.at(i)*1000).toTimeSpec(mDateTimeSpec), mDateTimeFormat);\n#endif\n      }\n    }\n  } else // mAutoTickLabels == false\n  {\n    if (mAutoTicks) // ticks generated automatically, but not ticklabels, so emit ticksRequest here for labels\n    {\n      emit ticksRequest();\n    }\n    // make sure provided tick label vector has correct (minimal) length:\n    if (mTickVectorLabels.size() < mTickVector.size())\n      mTickVectorLabels.resize(mTickVector.size());\n  }\n}\n\n/*! \\internal\n  \n  If \\ref setAutoTicks is set to true, this function is called by \\ref setupTickVectors to\n  generate reasonable tick positions (and subtick count). The algorithm tries to create\n  approximately <tt>mAutoTickCount</tt> ticks (set via \\ref setAutoTickCount).\n \n  If the scale is logarithmic, \\ref setAutoTickCount is ignored, and one tick is generated at every\n  power of the current logarithm base, set via \\ref setScaleLogBase.\n*/\nvoid QCPAxis::generateAutoTicks()\n{\n  if (mScaleType == stLinear)\n  {\n    if (mAutoTickStep)\n    {\n      // Generate tick positions according to linear scaling:\n      mTickStep = mRange.size()/(double)(mAutoTickCount+1e-10); // mAutoTickCount ticks on average, the small addition is to prevent jitter on exact integers\n      double magnitudeFactor = qPow(10.0, qFloor(qLn(mTickStep)/qLn(10.0))); // get magnitude factor e.g. 0.01, 1, 10, 1000 etc.\n      double tickStepMantissa = mTickStep/magnitudeFactor;\n      if (tickStepMantissa < 5)\n      {\n        // round digit after decimal point to 0.5\n        mTickStep = (int)(tickStepMantissa*2)/2.0*magnitudeFactor;\n      } else\n      {\n        // round to first digit in multiples of 2\n        mTickStep = (int)(tickStepMantissa/2.0)*2.0*magnitudeFactor;\n      }\n    }\n    if (mAutoSubTicks)\n      mSubTickCount = calculateAutoSubTickCount(mTickStep);\n    // Generate tick positions according to mTickStep:\n    qint64 firstStep = floor(mRange.lower/mTickStep);\n    qint64 lastStep = ceil(mRange.upper/mTickStep);\n    int tickcount = lastStep-firstStep+1;\n    if (tickcount < 0) tickcount = 0;\n    mTickVector.resize(tickcount);\n    for (int i=0; i<tickcount; ++i)\n      mTickVector[i] = (firstStep+i)*mTickStep;\n  } else // mScaleType == stLogarithmic\n  {\n    // Generate tick positions according to logbase scaling:\n    if (mRange.lower > 0 && mRange.upper > 0) // positive range\n    {\n      double lowerMag = basePow((int)floor(baseLog(mRange.lower)));\n      double currentMag = lowerMag;\n      mTickVector.clear();\n      mTickVector.append(currentMag);\n      while (currentMag < mRange.upper && currentMag > 0) // currentMag might be zero for ranges ~1e-300, just cancel in that case\n      {\n        currentMag *= mScaleLogBase;\n        mTickVector.append(currentMag);\n      }\n    } else if (mRange.lower < 0 && mRange.upper < 0) // negative range\n    {\n      double lowerMag = -basePow((int)ceil(baseLog(-mRange.lower)));\n      double currentMag = lowerMag;\n      mTickVector.clear();\n      mTickVector.append(currentMag);\n      while (currentMag < mRange.upper && currentMag < 0) // currentMag might be zero for ranges ~1e-300, just cancel in that case\n      {\n        currentMag /= mScaleLogBase;\n        mTickVector.append(currentMag);\n      }\n    } else // invalid range for logarithmic scale, because lower and upper have different sign\n    {\n      mTickVector.clear();\n      qDebug() << Q_FUNC_INFO << \"Invalid range for logarithmic plot: \" << mRange.lower << \"-\" << mRange.upper;\n    }\n  }\n}\n\n/*! \\internal\n  \n  Called by generateAutoTicks when \\ref setAutoSubTicks is set to true. Depending on the \\a\n  tickStep between two major ticks on the axis, a different number of sub ticks is appropriate. For\n  Example taking 4 sub ticks for a \\a tickStep of 1 makes more sense than taking 5 sub ticks,\n  because this corresponds to a sub tick step of 0.2, instead of the less intuitive 0.16667. Note\n  that a subtick count of 4 means dividing the major tick step into 5 sections.\n  \n  This is implemented by a hand made lookup for integer tick steps as well as fractional tick steps\n  with a fractional part of (approximately) 0.5. If a tick step is different (i.e. has no\n  fractional part close to 0.5), the currently set sub tick count (\\ref setSubTickCount) is\n  returned.\n*/\nint QCPAxis::calculateAutoSubTickCount(double tickStep) const\n{\n  int result = mSubTickCount; // default to current setting, if no proper value can be found\n  \n  // get mantissa of tickstep:\n  double magnitudeFactor = qPow(10.0, qFloor(qLn(tickStep)/qLn(10.0))); // get magnitude factor e.g. 0.01, 1, 10, 1000 etc.\n  double tickStepMantissa = tickStep/magnitudeFactor;\n  \n  // separate integer and fractional part of mantissa:\n  double epsilon = 0.01;\n  double intPartf;\n  int intPart;\n  double fracPart = modf(tickStepMantissa, &intPartf);\n  intPart = intPartf;\n  \n  // handle cases with (almost) integer mantissa:\n  if (fracPart < epsilon || 1.0-fracPart < epsilon)\n  {\n    if (1.0-fracPart < epsilon)\n      ++intPart;\n    switch (intPart)\n    {\n      case 1: result = 4; break; // 1.0 -> 0.2 substep\n      case 2: result = 3; break; // 2.0 -> 0.5 substep\n      case 3: result = 2; break; // 3.0 -> 1.0 substep\n      case 4: result = 3; break; // 4.0 -> 1.0 substep\n      case 5: result = 4; break; // 5.0 -> 1.0 substep\n      case 6: result = 2; break; // 6.0 -> 2.0 substep\n      case 7: result = 6; break; // 7.0 -> 1.0 substep\n      case 8: result = 3; break; // 8.0 -> 2.0 substep\n      case 9: result = 2; break; // 9.0 -> 3.0 substep\n    }\n  } else\n  {\n    // handle cases with significantly fractional mantissa:\n    if (qAbs(fracPart-0.5) < epsilon) // *.5 mantissa\n    {\n      switch (intPart)\n      {\n        case 1: result = 2; break; // 1.5 -> 0.5 substep\n        case 2: result = 4; break; // 2.5 -> 0.5 substep\n        case 3: result = 4; break; // 3.5 -> 0.7 substep\n        case 4: result = 2; break; // 4.5 -> 1.5 substep\n        case 5: result = 4; break; // 5.5 -> 1.1 substep (won't occur with autoTickStep from here on)\n        case 6: result = 4; break; // 6.5 -> 1.3 substep\n        case 7: result = 2; break; // 7.5 -> 2.5 substep\n        case 8: result = 4; break; // 8.5 -> 1.7 substep\n        case 9: result = 4; break; // 9.5 -> 1.9 substep\n      }\n    }\n    // if mantissa fraction isnt 0.0 or 0.5, don't bother finding good sub tick marks, leave default\n  }\n  \n  return result;\n}\n\n/* inherits documentation from base class */\nvoid QCPAxis::selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)\n{\n  Q_UNUSED(event)\n  SelectablePart part = details.value<SelectablePart>();\n  if (mSelectableParts.testFlag(part))\n  {\n    SelectableParts selBefore = mSelectedParts;\n    setSelectedParts(additive ? mSelectedParts^part : part);\n    if (selectionStateChanged)\n      *selectionStateChanged = mSelectedParts != selBefore;\n  }\n}\n\n/* inherits documentation from base class */\nvoid QCPAxis::deselectEvent(bool *selectionStateChanged)\n{\n  SelectableParts selBefore = mSelectedParts;\n  setSelectedParts(mSelectedParts & ~mSelectableParts);\n  if (selectionStateChanged)\n    *selectionStateChanged = mSelectedParts != selBefore;\n}\n\n/*! \\internal\n\n  A convenience function to easily set the QPainter::Antialiased hint on the provided \\a painter\n  before drawing axis lines.\n\n  This is the antialiasing state the painter passed to the \\ref draw method is in by default.\n  \n  This function takes into account the local setting of the antialiasing flag as well as the\n  overrides set with \\ref QCustomPlot::setAntialiasedElements and \\ref\n  QCustomPlot::setNotAntialiasedElements.\n  \n  \\see setAntialiased\n*/\nvoid QCPAxis::applyDefaultAntialiasingHint(QCPPainter *painter) const\n{\n  applyAntialiasingHint(painter, mAntialiased, QCP::aeAxes);\n}\n\n/*! \\internal\n  \n  Draws the axis with the specified \\a painter, using the internal QCPAxisPainterPrivate instance.\n\n*/\nvoid QCPAxis::draw(QCPPainter *painter)\n{\n  const int lowTick = mLowestVisibleTick;\n  const int highTick = mHighestVisibleTick;\n  QVector<double> subTickPositions; // the final coordToPixel transformed vector passed to QCPAxisPainter\n  QVector<double> tickPositions; // the final coordToPixel transformed vector passed to QCPAxisPainter\n  QVector<QString> tickLabels; // the final vector passed to QCPAxisPainter\n  tickPositions.reserve(highTick-lowTick+1);\n  tickLabels.reserve(highTick-lowTick+1);\n  subTickPositions.reserve(mSubTickVector.size());\n  \n  if (mTicks)\n  {\n    for (int i=lowTick; i<=highTick; ++i)\n    {\n      tickPositions.append(coordToPixel(mTickVector.at(i)));\n      if (mTickLabels)\n        tickLabels.append(mTickVectorLabels.at(i));\n    }\n    \n    if (mSubTickCount > 0)\n    {\n      const int subTickCount = mSubTickVector.size();\n      for (int i=0; i<subTickCount; ++i) // no need to check bounds because subticks are always only created inside current mRange\n        subTickPositions.append(coordToPixel(mSubTickVector.at(i)));\n    }\n  }\n  // transfer all properties of this axis to QCPAxisPainterPrivate which it needs to draw the axis.\n  // Note that some axis painter properties are already set by direct feed-through with QCPAxis setters\n  mAxisPainter->type = mAxisType;\n  mAxisPainter->basePen = getBasePen();\n  mAxisPainter->labelFont = getLabelFont();\n  mAxisPainter->labelColor = getLabelColor();\n  mAxisPainter->label = mLabel;\n  mAxisPainter->substituteExponent = mAutoTickLabels && mNumberBeautifulPowers && mTickLabelType == ltNumber;\n  mAxisPainter->tickPen = getTickPen();\n  mAxisPainter->subTickPen = getSubTickPen();\n  mAxisPainter->tickLabelFont = getTickLabelFont();\n  mAxisPainter->tickLabelColor = getTickLabelColor();\n  mAxisPainter->alignmentRect = mAxisRect->rect();\n  mAxisPainter->viewportRect = mParentPlot->viewport();\n  mAxisPainter->abbreviateDecimalPowers = mScaleType == stLogarithmic;\n  mAxisPainter->reversedEndings = mRangeReversed;\n  mAxisPainter->tickPositions = tickPositions;\n  mAxisPainter->tickLabels = tickLabels;\n  mAxisPainter->subTickPositions = subTickPositions;\n  mAxisPainter->draw(painter);\n}\n\n/*! \\internal\n  \n  Returns via \\a lowIndex and \\a highIndex, which ticks in the current tick vector are visible in\n  the current range. The return values are indices of the tick vector, not the positions of the\n  ticks themselves.\n  \n  The actual use of this function is when an external tick vector is provided, since it might\n  exceed far beyond the currently displayed range, and would cause unnecessary calculations e.g. of\n  subticks.\n  \n  If all ticks are outside the axis range, an inverted range is returned, i.e. highIndex will be\n  smaller than lowIndex. There is one case, where this function returns indices that are not really\n  visible in the current axis range: When the tick spacing is larger than the axis range size and\n  one tick is below the axis range and the next tick is already above the axis range. Because in\n  such cases it is usually desirable to know the tick pair, to draw proper subticks.\n*/\nvoid QCPAxis::visibleTickBounds(int &lowIndex, int &highIndex) const\n{\n  bool lowFound = false;\n  bool highFound = false;\n  lowIndex = 0;\n  highIndex = -1;\n  \n  for (int i=0; i < mTickVector.size(); ++i)\n  {\n    if (mTickVector.at(i) >= mRange.lower)\n    {\n      lowFound = true;\n      lowIndex = i;\n      break;\n    }\n  }\n  for (int i=mTickVector.size()-1; i >= 0; --i)\n  {\n    if (mTickVector.at(i) <= mRange.upper)\n    {\n      highFound = true;\n      highIndex = i;\n      break;\n    }\n  }\n  \n  if (!lowFound && highFound)\n    lowIndex = highIndex+1;\n  else if (lowFound && !highFound)\n    highIndex = lowIndex-1;\n}\n\n/*! \\internal\n  \n  A log function with the base mScaleLogBase, used mostly for coordinate transforms in logarithmic\n  scales with arbitrary log base. Uses the buffered mScaleLogBaseLogInv for faster calculation.\n  This is set to <tt>1.0/qLn(mScaleLogBase)</tt> in \\ref setScaleLogBase.\n  \n  \\see basePow, setScaleLogBase, setScaleType\n*/\ndouble QCPAxis::baseLog(double value) const\n{\n  return qLn(value)*mScaleLogBaseLogInv;\n}\n\n/*! \\internal\n  \n  A power function with the base mScaleLogBase, used mostly for coordinate transforms in\n  logarithmic scales with arbitrary log base.\n  \n  \\see baseLog, setScaleLogBase, setScaleType\n*/\ndouble QCPAxis::basePow(double value) const\n{\n  return qPow(mScaleLogBase, value);\n}\n\n/*! \\internal\n  \n  Returns the pen that is used to draw the axis base line. Depending on the selection state, this\n  is either mSelectedBasePen or mBasePen.\n*/\nQPen QCPAxis::getBasePen() const\n{\n  return mSelectedParts.testFlag(spAxis) ? mSelectedBasePen : mBasePen;\n}\n\n/*! \\internal\n  \n  Returns the pen that is used to draw the (major) ticks. Depending on the selection state, this\n  is either mSelectedTickPen or mTickPen.\n*/\nQPen QCPAxis::getTickPen() const\n{\n  return mSelectedParts.testFlag(spAxis) ? mSelectedTickPen : mTickPen;\n}\n\n/*! \\internal\n  \n  Returns the pen that is used to draw the subticks. Depending on the selection state, this\n  is either mSelectedSubTickPen or mSubTickPen.\n*/\nQPen QCPAxis::getSubTickPen() const\n{\n  return mSelectedParts.testFlag(spAxis) ? mSelectedSubTickPen : mSubTickPen;\n}\n\n/*! \\internal\n  \n  Returns the font that is used to draw the tick labels. Depending on the selection state, this\n  is either mSelectedTickLabelFont or mTickLabelFont.\n*/\nQFont QCPAxis::getTickLabelFont() const\n{\n  return mSelectedParts.testFlag(spTickLabels) ? mSelectedTickLabelFont : mTickLabelFont;\n}\n\n/*! \\internal\n  \n  Returns the font that is used to draw the axis label. Depending on the selection state, this\n  is either mSelectedLabelFont or mLabelFont.\n*/\nQFont QCPAxis::getLabelFont() const\n{\n  return mSelectedParts.testFlag(spAxisLabel) ? mSelectedLabelFont : mLabelFont;\n}\n\n/*! \\internal\n  \n  Returns the color that is used to draw the tick labels. Depending on the selection state, this\n  is either mSelectedTickLabelColor or mTickLabelColor.\n*/\nQColor QCPAxis::getTickLabelColor() const\n{\n  return mSelectedParts.testFlag(spTickLabels) ? mSelectedTickLabelColor : mTickLabelColor;\n}\n\n/*! \\internal\n  \n  Returns the color that is used to draw the axis label. Depending on the selection state, this\n  is either mSelectedLabelColor or mLabelColor.\n*/\nQColor QCPAxis::getLabelColor() const\n{\n  return mSelectedParts.testFlag(spAxisLabel) ? mSelectedLabelColor : mLabelColor;\n}\n\n/*! \\internal\n  \n  Returns the appropriate outward margin for this axis. It is needed if \\ref\n  QCPAxisRect::setAutoMargins is set to true on the parent axis rect. An axis with axis type \\ref\n  atLeft will return an appropriate left margin, \\ref atBottom will return an appropriate bottom\n  margin and so forth. For the calculation, this function goes through similar steps as \\ref draw,\n  so changing one function likely requires the modification of the other one as well.\n  \n  The margin consists of the outward tick length, tick label padding, tick label size, label\n  padding, label size, and padding.\n  \n  The margin is cached internally, so repeated calls while leaving the axis range, fonts, etc.\n  unchanged are very fast.\n*/\nint QCPAxis::calculateMargin()\n{\n  if (!mVisible) // if not visible, directly return 0, don't cache 0 because we can't react to setVisible in QCPAxis\n    return 0;\n  \n  if (mCachedMarginValid)\n    return mCachedMargin;\n  \n  // run through similar steps as QCPAxis::draw, and caluclate margin needed to fit axis and its labels\n  int margin = 0;\n  \n  int lowTick, highTick;\n  visibleTickBounds(lowTick, highTick);\n  QVector<double> tickPositions; // the final coordToPixel transformed vector passed to QCPAxisPainter\n  QVector<QString> tickLabels; // the final vector passed to QCPAxisPainter\n  tickPositions.reserve(highTick-lowTick+1);\n  tickLabels.reserve(highTick-lowTick+1);\n  if (mTicks)\n  {\n    for (int i=lowTick; i<=highTick; ++i)\n    {\n      tickPositions.append(coordToPixel(mTickVector.at(i)));\n      if (mTickLabels)\n        tickLabels.append(mTickVectorLabels.at(i));\n    }\n  }\n  // transfer all properties of this axis to QCPAxisPainterPrivate which it needs to calculate the size.\n  // Note that some axis painter properties are already set by direct feed-through with QCPAxis setters\n  mAxisPainter->type = mAxisType;\n  mAxisPainter->labelFont = getLabelFont();\n  mAxisPainter->label = mLabel;\n  mAxisPainter->tickLabelFont = mTickLabelFont;\n  mAxisPainter->alignmentRect = mAxisRect->rect();\n  mAxisPainter->viewportRect = mParentPlot->viewport();\n  mAxisPainter->tickPositions = tickPositions;\n  mAxisPainter->tickLabels = tickLabels;\n  margin += mAxisPainter->size();\n  margin += mPadding;\n\n  mCachedMargin = margin;\n  mCachedMarginValid = true;\n  return margin;\n}\n\n/* inherits documentation from base class */\nQCP::Interaction QCPAxis::selectionCategory() const\n{\n  return QCP::iSelectAxes;\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPAxisPainterPrivate\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPAxisPainterPrivate\n\n  \\internal\n  \\brief (Private)\n  \n  This is a private class and not part of the public QCustomPlot interface.\n  \n  It is used by QCPAxis to do the low-level drawing of axis backbone, tick marks, tick labels and\n  axis label. It also buffers the labels to reduce replot times. The parameters are configured by\n  directly accessing the public member variables.\n*/\n\n/*!\n  Constructs a QCPAxisPainterPrivate instance. Make sure to not create a new instance on every\n  redraw, to utilize the caching mechanisms.\n*/\nQCPAxisPainterPrivate::QCPAxisPainterPrivate(QCustomPlot *parentPlot) :\n  type(QCPAxis::atLeft),\n  basePen(QPen(Qt::black, 0, Qt::SolidLine, Qt::SquareCap)),\n  lowerEnding(QCPLineEnding::esNone),\n  upperEnding(QCPLineEnding::esNone),\n  labelPadding(0),\n  tickLabelPadding(0),\n  tickLabelRotation(0),\n  substituteExponent(true),\n  numberMultiplyCross(false),\n  tickLengthIn(5),\n  tickLengthOut(0),\n  subTickLengthIn(2),\n  subTickLengthOut(0),\n  tickPen(QPen(Qt::black, 0, Qt::SolidLine, Qt::SquareCap)),\n  subTickPen(QPen(Qt::black, 0, Qt::SolidLine, Qt::SquareCap)),\n  offset(0),\n  abbreviateDecimalPowers(false),\n  reversedEndings(false),\n  mParentPlot(parentPlot),\n  mLabelCache(16) // cache at most 16 (tick) labels\n{\n}\n\nQCPAxisPainterPrivate::~QCPAxisPainterPrivate()\n{\n}\n\n/*! \\internal\n  \n  Draws the axis with the specified \\a painter.\n  \n  The selection boxes (mAxisSelectionBox, mTickLabelsSelectionBox, mLabelSelectionBox) are set\n  here, too.\n*/\nvoid QCPAxisPainterPrivate::draw(QCPPainter *painter)\n{\n  QByteArray newHash = generateLabelParameterHash();\n  if (newHash != mLabelParameterHash)\n  {\n    mLabelCache.clear();\n    mLabelParameterHash = newHash;\n  }\n  \n  QPoint origin;\n  switch (type)\n  {\n    case QCPAxis::atLeft:   origin = alignmentRect.bottomLeft() +QPoint(-offset, 0); break;\n    case QCPAxis::atRight:  origin = alignmentRect.bottomRight()+QPoint(+offset, 0); break;\n    case QCPAxis::atTop:    origin = alignmentRect.topLeft()    +QPoint(0, -offset); break;\n    case QCPAxis::atBottom: origin = alignmentRect.bottomLeft() +QPoint(0, +offset); break;\n  }\n\n  double xCor = 0, yCor = 0; // paint system correction, for pixel exact matches (affects baselines and ticks of top/right axes)\n  switch (type)\n  {\n    case QCPAxis::atTop: yCor = -1; break;\n    case QCPAxis::atRight: xCor = 1; break;\n    default: break;\n  }\n\n  int margin = 0;\n  // draw baseline:\n  QLineF baseLine;\n  painter->setPen(basePen);\n  if (QCPAxis::orientation(type) == Qt::Horizontal)\n    baseLine.setPoints(origin+QPointF(xCor, yCor), origin+QPointF(alignmentRect.width()+xCor, yCor));\n  else\n    baseLine.setPoints(origin+QPointF(xCor, yCor), origin+QPointF(xCor, -alignmentRect.height()+yCor));\n  if (reversedEndings)\n    baseLine = QLineF(baseLine.p2(), baseLine.p1()); // won't make a difference for line itself, but for line endings later\n  painter->drawLine(baseLine);\n  \n  // draw ticks:\n  if (!tickPositions.isEmpty())\n  {\n    painter->setPen(tickPen);\n    int tickDir = (type == QCPAxis::atBottom || type == QCPAxis::atRight) ? -1 : 1; // direction of ticks (\"inward\" is right for left axis and left for right axis)\n    if (QCPAxis::orientation(type) == Qt::Horizontal)\n    {\n      for (int i=0; i<tickPositions.size(); ++i)\n        painter->drawLine(QLineF(tickPositions.at(i)+xCor, origin.y()-tickLengthOut*tickDir+yCor, tickPositions.at(i)+xCor, origin.y()+tickLengthIn*tickDir+yCor));\n    } else\n    {\n      for (int i=0; i<tickPositions.size(); ++i)\n        painter->drawLine(QLineF(origin.x()-tickLengthOut*tickDir+xCor, tickPositions.at(i)+yCor, origin.x()+tickLengthIn*tickDir+xCor, tickPositions.at(i)+yCor));\n    }\n  }\n  \n  // draw subticks:\n  if (!subTickPositions.isEmpty())\n  {\n    painter->setPen(subTickPen);\n    // direction of ticks (\"inward\" is right for left axis and left for right axis)\n    int tickDir = (type == QCPAxis::atBottom || type == QCPAxis::atRight) ? -1 : 1;\n    if (QCPAxis::orientation(type) == Qt::Horizontal)\n    {\n      for (int i=0; i<subTickPositions.size(); ++i)\n        painter->drawLine(QLineF(subTickPositions.at(i)+xCor, origin.y()-subTickLengthOut*tickDir+yCor, subTickPositions.at(i)+xCor, origin.y()+subTickLengthIn*tickDir+yCor));\n    } else\n    {\n      for (int i=0; i<subTickPositions.size(); ++i)\n        painter->drawLine(QLineF(origin.x()-subTickLengthOut*tickDir+xCor, subTickPositions.at(i)+yCor, origin.x()+subTickLengthIn*tickDir+xCor, subTickPositions.at(i)+yCor));\n    }\n  }\n  margin += qMax(0, qMax(tickLengthOut, subTickLengthOut));\n  \n  // draw axis base endings:\n  bool antialiasingBackup = painter->antialiasing();\n  painter->setAntialiasing(true); // always want endings to be antialiased, even if base and ticks themselves aren't\n  painter->setBrush(QBrush(basePen.color()));\n  QVector2D baseLineVector(baseLine.dx(), baseLine.dy());\n  if (lowerEnding.style() != QCPLineEnding::esNone)\n    lowerEnding.draw(painter, QVector2D(baseLine.p1())-baseLineVector.normalized()*lowerEnding.realLength()*(lowerEnding.inverted()?-1:1), -baseLineVector);\n  if (upperEnding.style() != QCPLineEnding::esNone)\n    upperEnding.draw(painter, QVector2D(baseLine.p2())+baseLineVector.normalized()*upperEnding.realLength()*(upperEnding.inverted()?-1:1), baseLineVector);\n  painter->setAntialiasing(antialiasingBackup);\n  \n  // tick labels:\n  QSize tickLabelsSize(0, 0); // size of largest tick label, for offset calculation of axis label\n  if (!tickLabels.isEmpty())\n  {\n    margin += tickLabelPadding;\n    painter->setFont(tickLabelFont);\n    painter->setPen(QPen(tickLabelColor));\n    const int maxLabelIndex = qMin(tickPositions.size(), tickLabels.size());\n    for (int i=0; i<maxLabelIndex; ++i)\n      placeTickLabel(painter, tickPositions.at(i), margin, tickLabels.at(i), &tickLabelsSize);\n    if (QCPAxis::orientation(type) == Qt::Horizontal)\n      margin += tickLabelsSize.height();\n    else\n      margin += tickLabelsSize.width();\n  }\n\n  // axis label:\n  QRect labelBounds;\n  if (!label.isEmpty())\n  {\n    margin += labelPadding;\n    painter->setFont(labelFont);\n    painter->setPen(QPen(labelColor));\n    labelBounds = painter->fontMetrics().boundingRect(0, 0, 0, 0, Qt::TextDontClip, label);\n    if (type == QCPAxis::atLeft)\n    {\n      QTransform oldTransform = painter->transform();\n      painter->translate((origin.x()-margin-labelBounds.height()), origin.y());\n      painter->rotate(-90);\n      painter->drawText(0, 0, alignmentRect.height(), labelBounds.height(), Qt::TextDontClip | Qt::AlignCenter, label);\n      painter->setTransform(oldTransform);\n    }\n    else if (type == QCPAxis::atRight)\n    {\n      QTransform oldTransform = painter->transform();\n      painter->translate((origin.x()+margin+labelBounds.height()), origin.y()-alignmentRect.height());\n      painter->rotate(90);\n      painter->drawText(0, 0, alignmentRect.height(), labelBounds.height(), Qt::TextDontClip | Qt::AlignCenter, label);\n      painter->setTransform(oldTransform);\n    }\n    else if (type == QCPAxis::atTop)\n      painter->drawText(origin.x(), origin.y()-margin-labelBounds.height(), alignmentRect.width(), labelBounds.height(), Qt::TextDontClip | Qt::AlignCenter, label);\n    else if (type == QCPAxis::atBottom)\n      painter->drawText(origin.x(), origin.y()+margin, alignmentRect.width(), labelBounds.height(), Qt::TextDontClip | Qt::AlignCenter, label);\n  }\n  \n  // set selection boxes:\n  int selectionTolerance = 0;\n  if (mParentPlot)\n    selectionTolerance = mParentPlot->selectionTolerance();\n  else\n    qDebug() << Q_FUNC_INFO << \"mParentPlot is null\";\n  int selAxisOutSize = qMax(qMax(tickLengthOut, subTickLengthOut), selectionTolerance);\n  int selAxisInSize = selectionTolerance;\n  int selTickLabelSize = (QCPAxis::orientation(type) == Qt::Horizontal ? tickLabelsSize.height() : tickLabelsSize.width());\n  int selTickLabelOffset = qMax(tickLengthOut, subTickLengthOut)+tickLabelPadding;\n  int selLabelSize = labelBounds.height();\n  int selLabelOffset = selTickLabelOffset+selTickLabelSize+labelPadding;\n  if (type == QCPAxis::atLeft)\n  {\n    mAxisSelectionBox.setCoords(origin.x()-selAxisOutSize, alignmentRect.top(), origin.x()+selAxisInSize, alignmentRect.bottom());\n    mTickLabelsSelectionBox.setCoords(origin.x()-selTickLabelOffset-selTickLabelSize, alignmentRect.top(), origin.x()-selTickLabelOffset, alignmentRect.bottom());\n    mLabelSelectionBox.setCoords(origin.x()-selLabelOffset-selLabelSize, alignmentRect.top(), origin.x()-selLabelOffset, alignmentRect.bottom());\n  } else if (type == QCPAxis::atRight)\n  {\n    mAxisSelectionBox.setCoords(origin.x()-selAxisInSize, alignmentRect.top(), origin.x()+selAxisOutSize, alignmentRect.bottom());\n    mTickLabelsSelectionBox.setCoords(origin.x()+selTickLabelOffset+selTickLabelSize, alignmentRect.top(), origin.x()+selTickLabelOffset, alignmentRect.bottom());\n    mLabelSelectionBox.setCoords(origin.x()+selLabelOffset+selLabelSize, alignmentRect.top(), origin.x()+selLabelOffset, alignmentRect.bottom());\n  } else if (type == QCPAxis::atTop)\n  {\n    mAxisSelectionBox.setCoords(alignmentRect.left(), origin.y()-selAxisOutSize, alignmentRect.right(), origin.y()+selAxisInSize);\n    mTickLabelsSelectionBox.setCoords(alignmentRect.left(), origin.y()-selTickLabelOffset-selTickLabelSize, alignmentRect.right(), origin.y()-selTickLabelOffset);\n    mLabelSelectionBox.setCoords(alignmentRect.left(), origin.y()-selLabelOffset-selLabelSize, alignmentRect.right(), origin.y()-selLabelOffset);\n  } else if (type == QCPAxis::atBottom)\n  {\n    mAxisSelectionBox.setCoords(alignmentRect.left(), origin.y()-selAxisInSize, alignmentRect.right(), origin.y()+selAxisOutSize);\n    mTickLabelsSelectionBox.setCoords(alignmentRect.left(), origin.y()+selTickLabelOffset+selTickLabelSize, alignmentRect.right(), origin.y()+selTickLabelOffset);\n    mLabelSelectionBox.setCoords(alignmentRect.left(), origin.y()+selLabelOffset+selLabelSize, alignmentRect.right(), origin.y()+selLabelOffset);\n  }\n  // draw hitboxes for debug purposes:\n  //painter->setBrush(Qt::NoBrush);\n  //painter->drawRects(QVector<QRect>() << mAxisSelectionBox << mTickLabelsSelectionBox << mLabelSelectionBox);\n}\n\n/*! \\internal\n  \n  Returns the size (\"margin\" in QCPAxisRect context, so measured perpendicular to the axis backbone\n  direction) needed to fit the axis.\n*/\nint QCPAxisPainterPrivate::size() const\n{\n  int result = 0;\n  \n  // get length of tick marks pointing outwards:\n  if (!tickPositions.isEmpty())\n    result += qMax(0, qMax(tickLengthOut, subTickLengthOut));\n  \n  // calculate size of tick labels:\n  QSize tickLabelsSize(0, 0);\n  if (!tickLabels.isEmpty())\n  {\n    for (int i=0; i<tickLabels.size(); ++i)\n      getMaxTickLabelSize(tickLabelFont, tickLabels.at(i), &tickLabelsSize);\n    result += QCPAxis::orientation(type) == Qt::Horizontal ? tickLabelsSize.height() : tickLabelsSize.width();\n    result += tickLabelPadding;\n  }\n  \n  // calculate size of axis label (only height needed, because left/right labels are rotated by 90 degrees):\n  if (!label.isEmpty())\n  {\n    QFontMetrics fontMetrics(labelFont);\n    QRect bounds;\n    bounds = fontMetrics.boundingRect(0, 0, 0, 0, Qt::TextDontClip | Qt::AlignHCenter | Qt::AlignVCenter, label);\n    result += bounds.height() + labelPadding;\n  }\n  \n  return result;\n}\n\n/*! \\internal\n  \n  Clears the internal label cache. Upon the next \\ref draw, all labels will be created new. This\n  method is called automatically in \\ref draw, if any parameters have changed that invalidate the\n  cached labels, such as font, color, etc.\n*/\nvoid QCPAxisPainterPrivate::clearCache()\n{\n  mLabelCache.clear();\n}\n\n/*! \\internal\n  \n  Returns a hash that allows uniquely identifying whether the label parameters have changed such\n  that the cached labels must be refreshed (\\ref clearCache). It is used in \\ref draw. If the\n  return value of this method hasn't changed since the last redraw, the respective label parameters\n  haven't changed and cached labels may be used.\n*/\nQByteArray QCPAxisPainterPrivate::generateLabelParameterHash() const\n{\n  QByteArray result;\n  result.append(QByteArray::number(tickLabelRotation));\n  result.append(QByteArray::number((int)substituteExponent));\n  result.append(QByteArray::number((int)numberMultiplyCross));\n  result.append(tickLabelColor.name()+QByteArray::number(tickLabelColor.alpha(), 16));\n  result.append(tickLabelFont.toString());\n  return result;\n}\n\n/*! \\internal\n  \n  Draws a single tick label with the provided \\a painter, utilizing the internal label cache to\n  significantly speed up drawing of labels that were drawn in previous calls. The tick label is\n  always bound to an axis, the distance to the axis is controllable via \\a distanceToAxis in\n  pixels. The pixel position in the axis direction is passed in the \\a position parameter. Hence\n  for the bottom axis, \\a position would indicate the horizontal pixel position (not coordinate),\n  at which the label should be drawn.\n  \n  In order to later draw the axis label in a place that doesn't overlap with the tick labels, the\n  largest tick label size is needed. This is acquired by passing a \\a tickLabelsSize to the \\ref\n  drawTickLabel calls during the process of drawing all tick labels of one axis. In every call, \\a\n  tickLabelsSize is expanded, if the drawn label exceeds the value \\a tickLabelsSize currently\n  holds.\n  \n  The label is drawn with the font and pen that are currently set on the \\a painter. To draw\n  superscripted powers, the font is temporarily made smaller by a fixed factor (see \\ref\n  getTickLabelData).\n*/\nvoid QCPAxisPainterPrivate::placeTickLabel(QCPPainter *painter, double position, int distanceToAxis, const QString &text, QSize *tickLabelsSize)\n{\n  // warning: if you change anything here, also adapt getMaxTickLabelSize() accordingly!\n  if (text.isEmpty()) return;\n  QSize finalSize;\n  QPointF labelAnchor;\n  switch (type)\n  {\n    case QCPAxis::atLeft:   labelAnchor = QPointF(alignmentRect.left()-distanceToAxis-offset, position); break;\n    case QCPAxis::atRight:  labelAnchor = QPointF(alignmentRect.right()+distanceToAxis+offset, position); break;\n    case QCPAxis::atTop:    labelAnchor = QPointF(position, alignmentRect.top()-distanceToAxis-offset); break;\n    case QCPAxis::atBottom: labelAnchor = QPointF(position, alignmentRect.bottom()+distanceToAxis+offset); break;\n  }\n  if (mParentPlot->plottingHints().testFlag(QCP::phCacheLabels) && !painter->modes().testFlag(QCPPainter::pmNoCaching)) // label caching enabled\n  {\n    if (!mLabelCache.contains(text))  // no cached label exists, create it\n    {\n      CachedLabel *newCachedLabel = new CachedLabel;\n      TickLabelData labelData = getTickLabelData(painter->font(), text);\n      QPointF drawOffset = getTickLabelDrawOffset(labelData);\n      newCachedLabel->offset = drawOffset+labelData.rotatedTotalBounds.topLeft();\n      newCachedLabel->pixmap = QPixmap(labelData.rotatedTotalBounds.size());\n      newCachedLabel->pixmap.fill(Qt::transparent);\n      QCPPainter cachePainter(&newCachedLabel->pixmap);\n      cachePainter.setPen(painter->pen());\n      drawTickLabel(&cachePainter, -labelData.rotatedTotalBounds.topLeft().x(), -labelData.rotatedTotalBounds.topLeft().y(), labelData);\n      mLabelCache.insert(text, newCachedLabel, 1);\n    }\n    // draw cached label:\n    const CachedLabel *cachedLabel = mLabelCache.object(text);\n    // if label would be partly clipped by widget border on sides, don't draw it:\n    if (QCPAxis::orientation(type) == Qt::Horizontal)\n    {\n      if (labelAnchor.x()+cachedLabel->offset.x()+cachedLabel->pixmap.width() > viewportRect.right() ||\n          labelAnchor.x()+cachedLabel->offset.x() < viewportRect.left())\n        return;\n    } else\n    {\n      if (labelAnchor.y()+cachedLabel->offset.y()+cachedLabel->pixmap.height() >viewportRect.bottom() ||\n          labelAnchor.y()+cachedLabel->offset.y() < viewportRect.top())\n        return;\n    }\n    painter->drawPixmap(labelAnchor+cachedLabel->offset, cachedLabel->pixmap);\n    finalSize = cachedLabel->pixmap.size();\n  } else // label caching disabled, draw text directly on surface:\n  {\n    TickLabelData labelData = getTickLabelData(painter->font(), text);\n    QPointF finalPosition = labelAnchor + getTickLabelDrawOffset(labelData);\n    // if label would be partly clipped by widget border on sides, don't draw it:\n    if (QCPAxis::orientation(type) == Qt::Horizontal)\n    {\n      if (finalPosition.x()+(labelData.rotatedTotalBounds.width()+labelData.rotatedTotalBounds.left()) > viewportRect.right() ||\n          finalPosition.x()+labelData.rotatedTotalBounds.left() < viewportRect.left())\n        return;\n    } else\n    {\n      if (finalPosition.y()+(labelData.rotatedTotalBounds.height()+labelData.rotatedTotalBounds.top()) > viewportRect.bottom() ||\n          finalPosition.y()+labelData.rotatedTotalBounds.top() < viewportRect.top())\n        return;\n    }\n    drawTickLabel(painter, finalPosition.x(), finalPosition.y(), labelData);\n    finalSize = labelData.rotatedTotalBounds.size();\n  }\n  \n  // expand passed tickLabelsSize if current tick label is larger:\n  if (finalSize.width() > tickLabelsSize->width())\n    tickLabelsSize->setWidth(finalSize.width());\n  if (finalSize.height() > tickLabelsSize->height())\n    tickLabelsSize->setHeight(finalSize.height());\n}\n\n/*! \\internal\n  \n  This is a \\ref placeTickLabel helper function.\n  \n  Draws the tick label specified in \\a labelData with \\a painter at the pixel positions \\a x and \\a\n  y. This function is used by \\ref placeTickLabel to create new tick labels for the cache, or to\n  directly draw the labels on the QCustomPlot surface when label caching is disabled, i.e. when\n  QCP::phCacheLabels plotting hint is not set.\n*/\nvoid QCPAxisPainterPrivate::drawTickLabel(QCPPainter *painter, double x, double y, const TickLabelData &labelData) const\n{\n  // backup painter settings that we're about to change:\n  QTransform oldTransform = painter->transform();\n  QFont oldFont = painter->font();\n  \n  // transform painter to position/rotation:\n  painter->translate(x, y);\n  if (!qFuzzyIsNull(tickLabelRotation))\n    painter->rotate(tickLabelRotation);\n  \n  // draw text:\n  if (!labelData.expPart.isEmpty()) // indicator that beautiful powers must be used\n  {\n    painter->setFont(labelData.baseFont);\n    painter->drawText(0, 0, 0, 0, Qt::TextDontClip, labelData.basePart);\n    painter->setFont(labelData.expFont);\n    painter->drawText(labelData.baseBounds.width()+1, 0, labelData.expBounds.width(), labelData.expBounds.height(), Qt::TextDontClip,  labelData.expPart);\n  } else\n  {\n    painter->setFont(labelData.baseFont);\n    painter->drawText(0, 0, labelData.totalBounds.width(), labelData.totalBounds.height(), Qt::TextDontClip | Qt::AlignHCenter, labelData.basePart);\n  }\n  \n  // reset painter settings to what it was before:\n  painter->setTransform(oldTransform);\n  painter->setFont(oldFont);\n}\n\n/*! \\internal\n  \n  This is a \\ref placeTickLabel helper function.\n  \n  Transforms the passed \\a text and \\a font to a tickLabelData structure that can then be further\n  processed by \\ref getTickLabelDrawOffset and \\ref drawTickLabel. It splits the text into base and\n  exponent if necessary (member substituteExponent) and calculates appropriate bounding boxes.\n*/\nQCPAxisPainterPrivate::TickLabelData QCPAxisPainterPrivate::getTickLabelData(const QFont &font, const QString &text) const\n{\n  TickLabelData result;\n  \n  // determine whether beautiful decimal powers should be used\n  bool useBeautifulPowers = false;\n  int ePos = -1;\n  if (substituteExponent)\n  {\n    ePos = text.indexOf('e');\n    if (ePos > -1)\n      useBeautifulPowers = true;\n  }\n  \n  // calculate text bounding rects and do string preparation for beautiful decimal powers:\n  result.baseFont = font;\n  if (result.baseFont.pointSizeF() > 0) // On some rare systems, this sometimes is initialized with -1 (Qt bug?), so we check here before possibly setting a negative value in the next line\n    result.baseFont.setPointSizeF(result.baseFont.pointSizeF()+0.05); // QFontMetrics.boundingRect has a bug for exact point sizes that make the results oscillate due to internal rounding\n  if (useBeautifulPowers)\n  {\n    // split text into parts of number/symbol that will be drawn normally and part that will be drawn as exponent:\n    result.basePart = text.left(ePos);\n    // in log scaling, we want to turn \"1*10^n\" into \"10^n\", else add multiplication sign and decimal base:\n    if (abbreviateDecimalPowers && result.basePart == \"1\")\n      result.basePart = \"10\";\n    else\n      result.basePart += (numberMultiplyCross ? QString(QChar(215)) : QString(QChar(183))) + \"10\";\n    result.expPart = text.mid(ePos+1);\n    // clip \"+\" and leading zeros off expPart:\n    while (result.expPart.length() > 2 && result.expPart.at(1) == '0') // length > 2 so we leave one zero when numberFormatChar is 'e'\n      result.expPart.remove(1, 1);\n    if (!result.expPart.isEmpty() && result.expPart.at(0) == '+')\n      result.expPart.remove(0, 1);\n    // prepare smaller font for exponent:\n    result.expFont = font;\n    result.expFont.setPointSize(result.expFont.pointSize()*0.75);\n    // calculate bounding rects of base part, exponent part and total one:\n    result.baseBounds = QFontMetrics(result.baseFont).boundingRect(0, 0, 0, 0, Qt::TextDontClip, result.basePart);\n    result.expBounds = QFontMetrics(result.expFont).boundingRect(0, 0, 0, 0, Qt::TextDontClip, result.expPart);\n    result.totalBounds = result.baseBounds.adjusted(0, 0, result.expBounds.width()+2, 0); // +2 consists of the 1 pixel spacing between base and exponent (see drawTickLabel) and an extra pixel to include AA\n  } else // useBeautifulPowers == false\n  {\n    result.basePart = text;\n    result.totalBounds = QFontMetrics(result.baseFont).boundingRect(0, 0, 0, 0, Qt::TextDontClip | Qt::AlignHCenter, result.basePart);\n  }\n  result.totalBounds.moveTopLeft(QPoint(0, 0)); // want bounding box aligned top left at origin, independent of how it was created, to make further processing simpler\n  \n  // calculate possibly different bounding rect after rotation:\n  result.rotatedTotalBounds = result.totalBounds;\n  if (!qFuzzyIsNull(tickLabelRotation))\n  {\n    QTransform transform;\n    transform.rotate(tickLabelRotation);\n    result.rotatedTotalBounds = transform.mapRect(result.rotatedTotalBounds);\n  }\n  \n  return result;\n}\n\n/*! \\internal\n  \n  This is a \\ref placeTickLabel helper function.\n  \n  Calculates the offset at which the top left corner of the specified tick label shall be drawn.\n  The offset is relative to a point right next to the tick the label belongs to.\n  \n  This function is thus responsible for e.g. centering tick labels under ticks and positioning them\n  appropriately when they are rotated.\n*/\nQPointF QCPAxisPainterPrivate::getTickLabelDrawOffset(const TickLabelData &labelData) const\n{\n  /*\n    calculate label offset from base point at tick (non-trivial, for best visual appearance): short\n    explanation for bottom axis: The anchor, i.e. the point in the label that is placed\n    horizontally under the corresponding tick is always on the label side that is closer to the\n    axis (e.g. the left side of the text when we're rotating clockwise). On that side, the height\n    is halved and the resulting point is defined the anchor. This way, a 90 degree rotated text\n    will be centered under the tick (i.e. displaced horizontally by half its height). At the same\n    time, a 45 degree rotated text will \"point toward\" its tick, as is typical for rotated tick\n    labels.\n  */\n  bool doRotation = !qFuzzyIsNull(tickLabelRotation);\n  bool flip = qFuzzyCompare(qAbs(tickLabelRotation), 90.0); // perfect +/-90 degree flip. Indicates vertical label centering on vertical axes.\n  double radians = tickLabelRotation/180.0*M_PI;\n  int x=0, y=0;\n  if (type == QCPAxis::atLeft)\n  {\n    if (doRotation)\n    {\n      if (tickLabelRotation > 0)\n      {\n        x = -qCos(radians)*labelData.totalBounds.width();\n        y = flip ? -labelData.totalBounds.width()/2.0 : -qSin(radians)*labelData.totalBounds.width()-qCos(radians)*labelData.totalBounds.height()/2.0;\n      } else\n      {\n        x = -qCos(-radians)*labelData.totalBounds.width()-qSin(-radians)*labelData.totalBounds.height();\n        y = flip ? +labelData.totalBounds.width()/2.0 : +qSin(-radians)*labelData.totalBounds.width()-qCos(-radians)*labelData.totalBounds.height()/2.0;\n      }\n    } else\n    {\n      x = -labelData.totalBounds.width();\n      y = -labelData.totalBounds.height()/2.0;\n    }\n  } else if (type == QCPAxis::atRight)\n  {\n    if (doRotation)\n    {\n      if (tickLabelRotation > 0)\n      {\n        x = +qSin(radians)*labelData.totalBounds.height();\n        y = flip ? -labelData.totalBounds.width()/2.0 : -qCos(radians)*labelData.totalBounds.height()/2.0;\n      } else\n      {\n        x = 0;\n        y = flip ? +labelData.totalBounds.width()/2.0 : -qCos(-radians)*labelData.totalBounds.height()/2.0;\n      }\n    } else\n    {\n      x = 0;\n      y = -labelData.totalBounds.height()/2.0;\n    }\n  } else if (type == QCPAxis::atTop)\n  {\n    if (doRotation)\n    {\n      if (tickLabelRotation > 0)\n      {\n        x = -qCos(radians)*labelData.totalBounds.width()+qSin(radians)*labelData.totalBounds.height()/2.0;\n        y = -qSin(radians)*labelData.totalBounds.width()-qCos(radians)*labelData.totalBounds.height();\n      } else\n      {\n        x = -qSin(-radians)*labelData.totalBounds.height()/2.0;\n        y = -qCos(-radians)*labelData.totalBounds.height();\n      }\n    } else\n    {\n      x = -labelData.totalBounds.width()/2.0;\n      y = -labelData.totalBounds.height();\n    }\n  } else if (type == QCPAxis::atBottom)\n  {\n    if (doRotation)\n    {\n      if (tickLabelRotation > 0)\n      {\n        x = +qSin(radians)*labelData.totalBounds.height()/2.0;\n        y = 0;\n      } else\n      {\n        x = -qCos(-radians)*labelData.totalBounds.width()-qSin(-radians)*labelData.totalBounds.height()/2.0;\n        y = +qSin(-radians)*labelData.totalBounds.width();\n      }\n    } else\n    {\n      x = -labelData.totalBounds.width()/2.0;\n      y = 0;\n    }\n  }\n  \n  return QPointF(x, y);\n}\n\n/*! \\internal\n  \n  Simulates the steps done by \\ref placeTickLabel by calculating bounding boxes of the text label\n  to be drawn, depending on number format etc. Since only the largest tick label is wanted for the\n  margin calculation, the passed \\a tickLabelsSize is only expanded, if it's currently set to a\n  smaller width/height.\n*/\nvoid QCPAxisPainterPrivate::getMaxTickLabelSize(const QFont &font, const QString &text,  QSize *tickLabelsSize) const\n{\n  // note: this function must return the same tick label sizes as the placeTickLabel function.\n  QSize finalSize;\n  if (mParentPlot->plottingHints().testFlag(QCP::phCacheLabels) && mLabelCache.contains(text)) // label caching enabled and have cached label\n  {\n    const CachedLabel *cachedLabel = mLabelCache.object(text);\n    finalSize = cachedLabel->pixmap.size();\n  } else // label caching disabled or no label with this text cached:\n  {\n    TickLabelData labelData = getTickLabelData(font, text);\n    finalSize = labelData.rotatedTotalBounds.size();\n  }\n  \n  // expand passed tickLabelsSize if current tick label is larger:\n  if (finalSize.width() > tickLabelsSize->width())\n    tickLabelsSize->setWidth(finalSize.width());\n  if (finalSize.height() > tickLabelsSize->height())\n    tickLabelsSize->setHeight(finalSize.height());\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPAbstractPlottable\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPAbstractPlottable\n  \\brief The abstract base class for all data representing objects in a plot.\n\n  It defines a very basic interface like name, pen, brush, visibility etc. Since this class is\n  abstract, it can't be instantiated. Use one of the subclasses or create a subclass yourself to\n  create new ways of displaying data (see \"Creating own plottables\" below).\n  \n  All further specifics are in the subclasses, for example:\n  \\li A normal graph with possibly a line, scatter points and error bars is displayed by \\ref QCPGraph\n  (typically created with \\ref QCustomPlot::addGraph).\n  \\li A parametric curve can be displayed with \\ref QCPCurve.\n  \\li A stackable bar chart can be achieved with \\ref QCPBars.\n  \\li A box of a statistical box plot is created with \\ref QCPStatisticalBox.\n  \n  \\section plottables-subclassing Creating own plottables\n  \n  To create an own plottable, you implement a subclass of QCPAbstractPlottable. These are the pure\n  virtual functions, you must implement:\n  \\li \\ref clearData\n  \\li \\ref selectTest\n  \\li \\ref draw\n  \\li \\ref drawLegendIcon\n  \\li \\ref getKeyRange\n  \\li \\ref getValueRange\n  \n  See the documentation of those functions for what they need to do.\n  \n  For drawing your plot, you can use the \\ref coordsToPixels functions to translate a point in plot\n  coordinates to pixel coordinates. This function is quite convenient, because it takes the\n  orientation of the key and value axes into account for you (x and y are swapped when the key axis\n  is vertical and the value axis horizontal). If you are worried about performance (i.e. you need\n  to translate many points in a loop like QCPGraph), you can directly use \\ref\n  QCPAxis::coordToPixel. However, you must then take care about the orientation of the axis\n  yourself.\n  \n  Here are some important members you inherit from QCPAbstractPlottable:\n  <table>\n  <tr>\n    <td>QCustomPlot *\\b mParentPlot</td>\n    <td>A pointer to the parent QCustomPlot instance. The parent plot is inferred from the axes that are passed in the constructor.</td>\n  </tr><tr>\n    <td>QString \\b mName</td>\n    <td>The name of the plottable.</td>\n  </tr><tr>\n    <td>QPen \\b mPen</td>\n    <td>The generic pen of the plottable. You should use this pen for the most prominent data representing lines in the plottable (e.g QCPGraph uses this pen for its graph lines and scatters)</td>\n  </tr><tr>\n    <td>QPen \\b mSelectedPen</td>\n    <td>The generic pen that should be used when the plottable is selected (hint: \\ref mainPen gives you the right pen, depending on selection state).</td>\n  </tr><tr>\n    <td>QBrush \\b mBrush</td>\n    <td>The generic brush of the plottable. You should use this brush for the most prominent fillable structures in the plottable (e.g. QCPGraph uses this brush to control filling under the graph)</td>\n  </tr><tr>\n    <td>QBrush \\b mSelectedBrush</td>\n    <td>The generic brush that should be used when the plottable is selected (hint: \\ref mainBrush gives you the right brush, depending on selection state).</td>\n  </tr><tr>\n    <td>QPointer<QCPAxis>\\b mKeyAxis, \\b mValueAxis</td>\n    <td>The key and value axes this plottable is attached to. Call their QCPAxis::coordToPixel functions to translate coordinates to pixels in either the key or value dimension.\n        Make sure to check whether the pointer is null before using it. If one of the axes is null, don't draw the plottable.</td>\n  </tr><tr>\n    <td>bool \\b mSelected</td>\n    <td>indicates whether the plottable is selected or not.</td>\n  </tr>\n  </table>\n*/\n\n/* start of documentation of pure virtual functions */\n\n/*! \\fn void QCPAbstractPlottable::clearData() = 0\n  Clears all data in the plottable.\n*/\n\n/*! \\fn void QCPAbstractPlottable::drawLegendIcon(QCPPainter *painter, const QRect &rect) const = 0\n  \\internal\n  \n  called by QCPLegend::draw (via QCPPlottableLegendItem::draw) to create a graphical representation\n  of this plottable inside \\a rect, next to the plottable name.\n*/\n\n/*! \\fn QCPRange QCPAbstractPlottable::getKeyRange(bool &foundRange, SignDomain inSignDomain) const = 0\n  \\internal\n  \n  called by rescaleAxes functions to get the full data key bounds. For logarithmic plots, one can\n  set \\a inSignDomain to either \\ref sdNegative or \\ref sdPositive in order to restrict the\n  returned range to that sign domain. E.g. when only negative range is wanted, set \\a inSignDomain\n  to \\ref sdNegative and all positive points will be ignored for range calculation. For no\n  restriction, just set \\a inSignDomain to \\ref sdBoth (default). \\a foundRange is an output\n  parameter that indicates whether a range could be found or not. If this is false, you shouldn't\n  use the returned range (e.g. no points in data).\n\n  Note that \\a foundRange is not the same as \\ref QCPRange::validRange, since the range returned by\n  this function may have size zero, which wouldn't count as a valid range.\n  \n  \\see rescaleAxes, getValueRange\n*/\n\n/*! \\fn QCPRange QCPAbstractPlottable::getValueRange(bool &foundRange, SignDomain inSignDomain) const = 0\n  \\internal\n  \n  called by rescaleAxes functions to get the full data value bounds. For logarithmic plots, one can\n  set \\a inSignDomain to either \\ref sdNegative or \\ref sdPositive in order to restrict the\n  returned range to that sign domain. E.g. when only negative range is wanted, set \\a inSignDomain\n  to \\ref sdNegative and all positive points will be ignored for range calculation. For no\n  restriction, just set \\a inSignDomain to \\ref sdBoth (default). \\a foundRange is an output\n  parameter that indicates whether a range could be found or not. If this is false, you shouldn't\n  use the returned range (e.g. no points in data).\n\n  Note that \\a foundRange is not the same as \\ref QCPRange::validRange, since the range returned by\n  this function may have size zero, which wouldn't count as a valid range.\n  \n  \\see rescaleAxes, getKeyRange\n*/\n\n/* end of documentation of pure virtual functions */\n/* start of documentation of signals */\n\n/*! \\fn void QCPAbstractPlottable::selectionChanged(bool selected)\n  \n  This signal is emitted when the selection state of this plottable has changed, either by user\n  interaction or by a direct call to \\ref setSelected.\n*/\n\n/*! \\fn void QCPAbstractPlottable::selectableChanged(bool selectable);\n  \n  This signal is emitted when the selectability of this plottable has changed.\n  \n  \\see setSelectable\n*/\n\n/* end of documentation of signals */\n\n/*!\n  Constructs an abstract plottable which uses \\a keyAxis as its key axis (\"x\") and \\a valueAxis as\n  its value axis (\"y\"). \\a keyAxis and \\a valueAxis must reside in the same QCustomPlot instance\n  and have perpendicular orientations. If either of these restrictions is violated, a corresponding\n  message is printed to the debug output (qDebug), the construction is not aborted, though.\n  \n  Since QCPAbstractPlottable is an abstract class that defines the basic interface to plottables,\n  it can't be directly instantiated.\n  \n  You probably want one of the subclasses like \\ref QCPGraph or \\ref QCPCurve instead.\n*/\nQCPAbstractPlottable::QCPAbstractPlottable(QCPAxis *keyAxis, QCPAxis *valueAxis) :\n  QCPLayerable(keyAxis->parentPlot(), \"\", keyAxis->axisRect()),\n  mName(\"\"),\n  mAntialiasedFill(true),\n  mAntialiasedScatters(true),\n  mAntialiasedErrorBars(false),\n  mPen(Qt::black),\n  mSelectedPen(Qt::black),\n  mBrush(Qt::NoBrush),\n  mSelectedBrush(Qt::NoBrush),\n  mKeyAxis(keyAxis),\n  mValueAxis(valueAxis),\n  mSelectable(true),\n  mSelected(false)\n{\n  if (keyAxis->parentPlot() != valueAxis->parentPlot())\n    qDebug() << Q_FUNC_INFO << \"Parent plot of keyAxis is not the same as that of valueAxis.\";\n  if (keyAxis->orientation() == valueAxis->orientation())\n    qDebug() << Q_FUNC_INFO << \"keyAxis and valueAxis must be orthogonal to each other.\";\n}\n\n/*!\n   The name is the textual representation of this plottable as it is displayed in the legend\n   (\\ref QCPLegend). It may contain any UTF-8 characters, including newlines.\n*/\nvoid QCPAbstractPlottable::setName(const QString &name)\n{\n  mName = name;\n}\n\n/*!\n  Sets whether fills of this plottable is drawn antialiased or not.\n  \n  Note that this setting may be overridden by \\ref QCustomPlot::setAntialiasedElements and \\ref\n  QCustomPlot::setNotAntialiasedElements.\n*/\nvoid QCPAbstractPlottable::setAntialiasedFill(bool enabled)\n{\n  mAntialiasedFill = enabled;\n}\n\n/*!\n  Sets whether the scatter symbols of this plottable are drawn antialiased or not.\n  \n  Note that this setting may be overridden by \\ref QCustomPlot::setAntialiasedElements and \\ref\n  QCustomPlot::setNotAntialiasedElements.\n*/\nvoid QCPAbstractPlottable::setAntialiasedScatters(bool enabled)\n{\n  mAntialiasedScatters = enabled;\n}\n\n/*!\n  Sets whether the error bars of this plottable are drawn antialiased or not.\n  \n  Note that this setting may be overridden by \\ref QCustomPlot::setAntialiasedElements and \\ref\n  QCustomPlot::setNotAntialiasedElements.\n*/\nvoid QCPAbstractPlottable::setAntialiasedErrorBars(bool enabled)\n{\n  mAntialiasedErrorBars = enabled;\n}\n\n\n/*!\n  The pen is used to draw basic lines that make up the plottable representation in the\n  plot.\n  \n  For example, the \\ref QCPGraph subclass draws its graph lines and scatter points\n  with this pen.\n\n  \\see setBrush\n*/\nvoid QCPAbstractPlottable::setPen(const QPen &pen)\n{\n  mPen = pen;\n}\n\n/*!\n  When the plottable is selected, this pen is used to draw basic lines instead of the normal\n  pen set via \\ref setPen.\n\n  \\see setSelected, setSelectable, setSelectedBrush, selectTest\n*/\nvoid QCPAbstractPlottable::setSelectedPen(const QPen &pen)\n{\n  mSelectedPen = pen;\n}\n\n/*!\n  The brush is used to draw basic fills of the plottable representation in the\n  plot. The Fill can be a color, gradient or texture, see the usage of QBrush.\n  \n  For example, the \\ref QCPGraph subclass draws the fill under the graph with this brush, when\n  it's not set to Qt::NoBrush.\n\n  \\see setPen\n*/\nvoid QCPAbstractPlottable::setBrush(const QBrush &brush)\n{\n  mBrush = brush;\n}\n\n/*!\n  When the plottable is selected, this brush is used to draw fills instead of the normal\n  brush set via \\ref setBrush.\n\n  \\see setSelected, setSelectable, setSelectedPen, selectTest\n*/\nvoid QCPAbstractPlottable::setSelectedBrush(const QBrush &brush)\n{\n  mSelectedBrush = brush;\n}\n\n/*!\n  The key axis of a plottable can be set to any axis of a QCustomPlot, as long as it is orthogonal\n  to the plottable's value axis. This function performs no checks to make sure this is the case.\n  The typical mathematical choice is to use the x-axis (QCustomPlot::xAxis) as key axis and the\n  y-axis (QCustomPlot::yAxis) as value axis.\n  \n  Normally, the key and value axes are set in the constructor of the plottable (or \\ref\n  QCustomPlot::addGraph when working with QCPGraphs through the dedicated graph interface).\n\n  \\see setValueAxis\n*/\nvoid QCPAbstractPlottable::setKeyAxis(QCPAxis *axis)\n{\n  mKeyAxis = axis;\n}\n\n/*!\n  The value axis of a plottable can be set to any axis of a QCustomPlot, as long as it is\n  orthogonal to the plottable's key axis. This function performs no checks to make sure this is the\n  case. The typical mathematical choice is to use the x-axis (QCustomPlot::xAxis) as key axis and\n  the y-axis (QCustomPlot::yAxis) as value axis.\n\n  Normally, the key and value axes are set in the constructor of the plottable (or \\ref\n  QCustomPlot::addGraph when working with QCPGraphs through the dedicated graph interface).\n  \n  \\see setKeyAxis\n*/\nvoid QCPAbstractPlottable::setValueAxis(QCPAxis *axis)\n{\n  mValueAxis = axis;\n}\n\n/*!\n  Sets whether the user can (de-)select this plottable by clicking on the QCustomPlot surface.\n  (When \\ref QCustomPlot::setInteractions contains iSelectPlottables.)\n  \n  However, even when \\a selectable was set to false, it is possible to set the selection manually,\n  by calling \\ref setSelected directly.\n  \n  \\see setSelected\n*/\nvoid QCPAbstractPlottable::setSelectable(bool selectable)\n{\n  if (mSelectable != selectable)\n  {\n    mSelectable = selectable;\n    emit selectableChanged(mSelectable);\n  }\n}\n\n/*!\n  Sets whether this plottable is selected or not. When selected, it uses a different pen and brush\n  to draw its lines and fills, see \\ref setSelectedPen and \\ref setSelectedBrush.\n\n  The entire selection mechanism for plottables is handled automatically when \\ref\n  QCustomPlot::setInteractions contains iSelectPlottables. You only need to call this function when\n  you wish to change the selection state manually.\n  \n  This function can change the selection state even when \\ref setSelectable was set to false.\n  \n  emits the \\ref selectionChanged signal when \\a selected is different from the previous selection state.\n  \n  \\see setSelectable, selectTest\n*/\nvoid QCPAbstractPlottable::setSelected(bool selected)\n{\n  if (mSelected != selected)\n  {\n    mSelected = selected;\n    emit selectionChanged(mSelected);\n  }\n}\n\n/*!\n  Rescales the key and value axes associated with this plottable to contain all displayed data, so\n  the whole plottable is visible. If the scaling of an axis is logarithmic, rescaleAxes will make\n  sure not to rescale to an illegal range i.e. a range containing different signs and/or zero.\n  Instead it will stay in the current sign domain and ignore all parts of the plottable that lie\n  outside of that domain.\n  \n  \\a onlyEnlarge makes sure the ranges are only expanded, never reduced. So it's possible to show\n  multiple plottables in their entirety by multiple calls to rescaleAxes where the first call has\n  \\a onlyEnlarge set to false (the default), and all subsequent set to true.\n  \n  \\see rescaleKeyAxis, rescaleValueAxis, QCustomPlot::rescaleAxes, QCPAxis::rescale\n*/\nvoid QCPAbstractPlottable::rescaleAxes(bool onlyEnlarge) const\n{\n  rescaleKeyAxis(onlyEnlarge);\n  rescaleValueAxis(onlyEnlarge);\n}\n\n/*!\n  Rescales the key axis of the plottable so the whole plottable is visible.\n  \n  See \\ref rescaleAxes for detailed behaviour.\n*/\nvoid QCPAbstractPlottable::rescaleKeyAxis(bool onlyEnlarge) const\n{\n  QCPAxis *keyAxis = mKeyAxis.data();\n  if (!keyAxis) { qDebug() << Q_FUNC_INFO << \"invalid key axis\"; return; }\n  \n  SignDomain signDomain = sdBoth;\n  if (keyAxis->scaleType() == QCPAxis::stLogarithmic)\n    signDomain = (keyAxis->range().upper < 0 ? sdNegative : sdPositive);\n  \n  bool foundRange;\n  QCPRange newRange = getKeyRange(foundRange, signDomain);\n  if (foundRange)\n  {\n    if (onlyEnlarge)\n      newRange.expand(keyAxis->range());\n    if (!QCPRange::validRange(newRange)) // likely due to range being zero (plottable has only constant data in this axis dimension), shift current range to at least center the plottable\n    {\n      double center = (newRange.lower+newRange.upper)*0.5; // upper and lower should be equal anyway, but just to make sure, incase validRange returned false for other reason\n      if (keyAxis->scaleType() == QCPAxis::stLinear)\n      {\n        newRange.lower = center-keyAxis->range().size()/2.0;\n        newRange.upper = center+keyAxis->range().size()/2.0;\n      } else // scaleType() == stLogarithmic\n      {\n        newRange.lower = center/qSqrt(keyAxis->range().upper/keyAxis->range().lower);\n        newRange.upper = center*qSqrt(keyAxis->range().upper/keyAxis->range().lower);\n      }\n    }\n    keyAxis->setRange(newRange);\n  }\n}\n\n/*!\n  Rescales the value axis of the plottable so the whole plottable is visible.\n  \n  Returns true if the axis was actually scaled. This might not be the case if this plottable has an\n  invalid range, e.g. because it has no data points.\n  \n  See \\ref rescaleAxes for detailed behaviour.\n*/\nvoid QCPAbstractPlottable::rescaleValueAxis(bool onlyEnlarge) const\n{\n  QCPAxis *valueAxis = mValueAxis.data();\n  if (!valueAxis) { qDebug() << Q_FUNC_INFO << \"invalid value axis\"; return; }\n  \n  SignDomain signDomain = sdBoth;\n  if (valueAxis->scaleType() == QCPAxis::stLogarithmic)\n    signDomain = (valueAxis->range().upper < 0 ? sdNegative : sdPositive);\n  \n  bool foundRange;\n  QCPRange newRange = getValueRange(foundRange, signDomain);\n  if (foundRange)\n  {\n    if (onlyEnlarge)\n      newRange.expand(valueAxis->range());\n    if (!QCPRange::validRange(newRange)) // likely due to range being zero (plottable has only constant data in this axis dimension), shift current range to at least center the plottable\n    {\n      double center = (newRange.lower+newRange.upper)*0.5; // upper and lower should be equal anyway, but just to make sure, incase validRange returned false for other reason\n      if (valueAxis->scaleType() == QCPAxis::stLinear)\n      {\n        newRange.lower = center-valueAxis->range().size()/2.0;\n        newRange.upper = center+valueAxis->range().size()/2.0;\n      } else // scaleType() == stLogarithmic\n      {\n        newRange.lower = center/qSqrt(valueAxis->range().upper/valueAxis->range().lower);\n        newRange.upper = center*qSqrt(valueAxis->range().upper/valueAxis->range().lower);\n      }\n    }\n    valueAxis->setRange(newRange);\n  }\n}\n\n/*!\n  Adds this plottable to the legend of the parent QCustomPlot (QCustomPlot::legend).\n    \n  Normally, a QCPPlottableLegendItem is created and inserted into the legend. If the plottable\n  needs a more specialized representation in the legend, this function will take this into account\n  and instead create the specialized subclass of QCPAbstractLegendItem.\n    \n  Returns true on success, i.e. when the legend exists and a legend item associated with this plottable isn't already in\n  the legend.\n    \n  \\see removeFromLegend, QCPLegend::addItem\n*/\nbool QCPAbstractPlottable::addToLegend()\n{\n  if (!mParentPlot || !mParentPlot->legend)\n    return false;\n  \n  if (!mParentPlot->legend->hasItemWithPlottable(this))\n  {\n    mParentPlot->legend->addItem(new QCPPlottableLegendItem(mParentPlot->legend, this));\n    return true;\n  } else\n    return false;\n}\n\n/*!\n  Removes the plottable from the legend of the parent QCustomPlot. This means the\n  QCPAbstractLegendItem (usually a QCPPlottableLegendItem) that is associated with this plottable\n  is removed.\n    \n  Returns true on success, i.e. if the legend exists and a legend item associated with this\n  plottable was found and removed.\n    \n  \\see addToLegend, QCPLegend::removeItem\n*/\nbool QCPAbstractPlottable::removeFromLegend() const\n{\n  if (!mParentPlot->legend)\n    return false;\n  \n  if (QCPPlottableLegendItem *lip = mParentPlot->legend->itemWithPlottable(this))\n    return mParentPlot->legend->removeItem(lip);\n  else\n    return false;\n}\n\n/* inherits documentation from base class */\nQRect QCPAbstractPlottable::clipRect() const\n{\n  if (mKeyAxis && mValueAxis)\n    return mKeyAxis.data()->axisRect()->rect() & mValueAxis.data()->axisRect()->rect();\n  else\n    return QRect();\n}\n\n/* inherits documentation from base class */\nQCP::Interaction QCPAbstractPlottable::selectionCategory() const\n{\n  return QCP::iSelectPlottables;\n}\n\n/*! \\internal\n  \n  Convenience function for transforming a key/value pair to pixels on the QCustomPlot surface,\n  taking the orientations of the axes associated with this plottable into account (e.g. whether key\n  represents x or y).\n  \n  \\a key and \\a value are transformed to the coodinates in pixels and are written to \\a x and \\a y.\n    \n  \\see pixelsToCoords, QCPAxis::coordToPixel\n*/\nvoid QCPAbstractPlottable::coordsToPixels(double key, double value, double &x, double &y) const\n{\n  QCPAxis *keyAxis = mKeyAxis.data();\n  QCPAxis *valueAxis = mValueAxis.data();\n  if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << \"invalid key or value axis\"; return; }\n  \n  if (keyAxis->orientation() == Qt::Horizontal)\n  {\n    x = keyAxis->coordToPixel(key);\n    y = valueAxis->coordToPixel(value);\n  } else\n  {\n    y = keyAxis->coordToPixel(key);\n    x = valueAxis->coordToPixel(value);\n  }\n}\n\n/*! \\internal\n  \\overload\n  \n  Returns the input as pixel coordinates in a QPointF.\n*/\nconst QPointF QCPAbstractPlottable::coordsToPixels(double key, double value) const\n{\n  QCPAxis *keyAxis = mKeyAxis.data();\n  QCPAxis *valueAxis = mValueAxis.data();\n  if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << \"invalid key or value axis\"; return QPointF(); }\n  \n  if (keyAxis->orientation() == Qt::Horizontal)\n    return QPointF(keyAxis->coordToPixel(key), valueAxis->coordToPixel(value));\n  else\n    return QPointF(valueAxis->coordToPixel(value), keyAxis->coordToPixel(key));\n}\n\n/*! \\internal\n  \n  Convenience function for transforming a x/y pixel pair on the QCustomPlot surface to plot coordinates,\n  taking the orientations of the axes associated with this plottable into account (e.g. whether key\n  represents x or y).\n  \n  \\a x and \\a y are transformed to the plot coodinates and are written to \\a key and \\a value.\n    \n  \\see coordsToPixels, QCPAxis::coordToPixel\n*/\nvoid QCPAbstractPlottable::pixelsToCoords(double x, double y, double &key, double &value) const\n{\n  QCPAxis *keyAxis = mKeyAxis.data();\n  QCPAxis *valueAxis = mValueAxis.data();\n  if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << \"invalid key or value axis\"; return; }\n  \n  if (keyAxis->orientation() == Qt::Horizontal)\n  {\n    key = keyAxis->pixelToCoord(x);\n    value = valueAxis->pixelToCoord(y);\n  } else\n  {\n    key = keyAxis->pixelToCoord(y);\n    value = valueAxis->pixelToCoord(x);\n  }\n}\n\n/*! \\internal\n  \\overload\n\n  Returns the pixel input \\a pixelPos as plot coordinates \\a key and \\a value.\n*/\nvoid QCPAbstractPlottable::pixelsToCoords(const QPointF &pixelPos, double &key, double &value) const\n{\n  pixelsToCoords(pixelPos.x(), pixelPos.y(), key, value);\n}\n\n/*! \\internal\n\n  Returns the pen that should be used for drawing lines of the plottable. Returns mPen when the\n  graph is not selected and mSelectedPen when it is.\n*/\nQPen QCPAbstractPlottable::mainPen() const\n{\n  return mSelected ? mSelectedPen : mPen;\n}\n\n/*! \\internal\n\n  Returns the brush that should be used for drawing fills of the plottable. Returns mBrush when the\n  graph is not selected and mSelectedBrush when it is.\n*/\nQBrush QCPAbstractPlottable::mainBrush() const\n{\n  return mSelected ? mSelectedBrush : mBrush;\n}\n\n/*! \\internal\n\n  A convenience function to easily set the QPainter::Antialiased hint on the provided \\a painter\n  before drawing plottable lines.\n\n  This is the antialiasing state the painter passed to the \\ref draw method is in by default.\n  \n  This function takes into account the local setting of the antialiasing flag as well as the\n  overrides set with \\ref QCustomPlot::setAntialiasedElements and \\ref\n  QCustomPlot::setNotAntialiasedElements.\n  \n  \\see setAntialiased, applyFillAntialiasingHint, applyScattersAntialiasingHint, applyErrorBarsAntialiasingHint\n*/\nvoid QCPAbstractPlottable::applyDefaultAntialiasingHint(QCPPainter *painter) const\n{\n  applyAntialiasingHint(painter, mAntialiased, QCP::aePlottables);\n}\n\n/*! \\internal\n\n  A convenience function to easily set the QPainter::Antialiased hint on the provided \\a painter\n  before drawing plottable fills.\n  \n  This function takes into account the local setting of the antialiasing flag as well as the\n  overrides set with \\ref QCustomPlot::setAntialiasedElements and \\ref\n  QCustomPlot::setNotAntialiasedElements.\n  \n  \\see setAntialiased, applyDefaultAntialiasingHint, applyScattersAntialiasingHint, applyErrorBarsAntialiasingHint\n*/\nvoid QCPAbstractPlottable::applyFillAntialiasingHint(QCPPainter *painter) const\n{\n  applyAntialiasingHint(painter, mAntialiasedFill, QCP::aeFills);\n}\n\n/*! \\internal\n\n  A convenience function to easily set the QPainter::Antialiased hint on the provided \\a painter\n  before drawing plottable scatter points.\n  \n  This function takes into account the local setting of the antialiasing flag as well as the\n  overrides set with \\ref QCustomPlot::setAntialiasedElements and \\ref\n  QCustomPlot::setNotAntialiasedElements.\n  \n  \\see setAntialiased, applyFillAntialiasingHint, applyDefaultAntialiasingHint, applyErrorBarsAntialiasingHint\n*/\nvoid QCPAbstractPlottable::applyScattersAntialiasingHint(QCPPainter *painter) const\n{\n  applyAntialiasingHint(painter, mAntialiasedScatters, QCP::aeScatters);\n}\n\n/*! \\internal\n\n  A convenience function to easily set the QPainter::Antialiased hint on the provided \\a painter\n  before drawing plottable error bars.\n  \n  This function takes into account the local setting of the antialiasing flag as well as the\n  overrides set with \\ref QCustomPlot::setAntialiasedElements and \\ref\n  QCustomPlot::setNotAntialiasedElements.\n  \n  \\see setAntialiased, applyFillAntialiasingHint, applyScattersAntialiasingHint, applyDefaultAntialiasingHint\n*/\nvoid QCPAbstractPlottable::applyErrorBarsAntialiasingHint(QCPPainter *painter) const\n{\n  applyAntialiasingHint(painter, mAntialiasedErrorBars, QCP::aeErrorBars);\n}\n\n/*! \\internal\n\n  Finds the shortest squared distance of \\a point to the line segment defined by \\a start and \\a\n  end.\n  \n  This function may be used to help with the implementation of the \\ref selectTest function for\n  specific plottables.\n  \n  \\note This function is identical to QCPAbstractItem::distSqrToLine\n*/\ndouble QCPAbstractPlottable::distSqrToLine(const QPointF &start, const QPointF &end, const QPointF &point) const\n{\n  QVector2D a(start);\n  QVector2D b(end);\n  QVector2D p(point);\n  QVector2D v(b-a);\n  \n  double vLengthSqr = v.lengthSquared();\n  if (!qFuzzyIsNull(vLengthSqr))\n  {\n    double mu = QVector2D::dotProduct(p-a, v)/vLengthSqr;\n    if (mu < 0)\n      return (a-p).lengthSquared();\n    else if (mu > 1)\n      return (b-p).lengthSquared();\n    else\n      return ((a + mu*v)-p).lengthSquared();\n  } else\n    return (a-p).lengthSquared();\n}\n\n/* inherits documentation from base class */\nvoid QCPAbstractPlottable::selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)\n{\n  Q_UNUSED(event)\n  Q_UNUSED(details)\n  if (mSelectable)\n  {\n    bool selBefore = mSelected;\n    setSelected(additive ? !mSelected : true);\n    if (selectionStateChanged)\n      *selectionStateChanged = mSelected != selBefore;\n  }\n}\n\n/* inherits documentation from base class */\nvoid QCPAbstractPlottable::deselectEvent(bool *selectionStateChanged)\n{\n  if (mSelectable)\n  {\n    bool selBefore = mSelected;\n    setSelected(false);\n    if (selectionStateChanged)\n      *selectionStateChanged = mSelected != selBefore;\n  }\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPItemAnchor\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPItemAnchor\n  \\brief An anchor of an item to which positions can be attached to.\n  \n  An item (QCPAbstractItem) may have one or more anchors. Unlike QCPItemPosition, an anchor doesn't\n  control anything on its item, but provides a way to tie other items via their positions to the\n  anchor.\n\n  For example, a QCPItemRect is defined by its positions \\a topLeft and \\a bottomRight.\n  Additionally it has various anchors like \\a top, \\a topRight or \\a bottomLeft etc. So you can\n  attach the \\a start (which is a QCPItemPosition) of a QCPItemLine to one of the anchors by\n  calling QCPItemPosition::setParentAnchor on \\a start, passing the wanted anchor of the\n  QCPItemRect. This way the start of the line will now always follow the respective anchor location\n  on the rect item.\n  \n  Note that QCPItemPosition derives from QCPItemAnchor, so every position can also serve as an\n  anchor to other positions.\n  \n  To learn how to provide anchors in your own item subclasses, see the subclassing section of the\n  QCPAbstractItem documentation.\n*/\n\n/* start documentation of inline functions */\n\n/*! \\fn virtual QCPItemPosition *QCPItemAnchor::toQCPItemPosition()\n  \n  Returns 0 if this instance is merely a QCPItemAnchor, and a valid pointer of type QCPItemPosition* if\n  it actually is a QCPItemPosition (which is a subclass of QCPItemAnchor).\n  \n  This safe downcast functionality could also be achieved with a dynamic_cast. However, QCustomPlot avoids\n  dynamic_cast to work with projects that don't have RTTI support enabled (e.g. -fno-rtti flag with\n  gcc compiler).\n*/\n\n/* end documentation of inline functions */\n\n/*!\n  Creates a new QCPItemAnchor. You shouldn't create QCPItemAnchor instances directly, even if\n  you want to make a new item subclass. Use \\ref QCPAbstractItem::createAnchor instead, as\n  explained in the subclassing section of the QCPAbstractItem documentation.\n*/\nQCPItemAnchor::QCPItemAnchor(QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString name, int anchorId) :\n  mName(name),\n  mParentPlot(parentPlot),\n  mParentItem(parentItem),\n  mAnchorId(anchorId)\n{\n}\n\nQCPItemAnchor::~QCPItemAnchor()\n{\n  // unregister as parent at children:\n  QList<QCPItemPosition*> currentChildren(mChildren.toList());\n  for (int i=0; i<currentChildren.size(); ++i)\n    currentChildren.at(i)->setParentAnchor(0); // this acts back on this anchor and child removes itself from mChildren\n}\n\n/*!\n  Returns the final absolute pixel position of the QCPItemAnchor on the QCustomPlot surface.\n  \n  The pixel information is internally retrieved via QCPAbstractItem::anchorPixelPosition of the\n  parent item, QCPItemAnchor is just an intermediary.\n*/\nQPointF QCPItemAnchor::pixelPoint() const\n{\n  if (mParentItem)\n  {\n    if (mAnchorId > -1)\n    {\n      return mParentItem->anchorPixelPoint(mAnchorId);\n    } else\n    {\n      qDebug() << Q_FUNC_INFO << \"no valid anchor id set:\" << mAnchorId;\n      return QPointF();\n    }\n  } else\n  {\n    qDebug() << Q_FUNC_INFO << \"no parent item set\";\n    return QPointF();\n  }\n}\n\n/*! \\internal\n\n  Adds \\a pos to the child list of this anchor. This is necessary to notify the children prior to\n  destruction of the anchor.\n  \n  Note that this function does not change the parent setting in \\a pos.\n*/\nvoid QCPItemAnchor::addChild(QCPItemPosition *pos)\n{\n  if (!mChildren.contains(pos))\n    mChildren.insert(pos);\n  else\n    qDebug() << Q_FUNC_INFO << \"provided pos is child already\" << reinterpret_cast<quintptr>(pos);\n}\n\n/*! \\internal\n\n  Removes \\a pos from the child list of this anchor.\n  \n  Note that this function does not change the parent setting in \\a pos.\n*/\nvoid QCPItemAnchor::removeChild(QCPItemPosition *pos)\n{\n  if (!mChildren.remove(pos))\n    qDebug() << Q_FUNC_INFO << \"provided pos isn't child\" << reinterpret_cast<quintptr>(pos);\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPItemPosition\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPItemPosition\n  \\brief Manages the position of an item.\n  \n  Every item has at least one public QCPItemPosition member pointer which provides ways to position the\n  item on the QCustomPlot surface. Some items have multiple positions, for example QCPItemRect has two:\n  \\a topLeft and \\a bottomRight.\n\n  QCPItemPosition has a type (\\ref PositionType) that can be set with \\ref setType. This type defines\n  how coordinates passed to \\ref setCoords are to be interpreted, e.g. as absolute pixel coordinates, as\n  plot coordinates of certain axes, etc.\n\n  Further, QCPItemPosition may have a parent QCPItemAnchor, see \\ref setParentAnchor. (Note that every\n  QCPItemPosition inherits from QCPItemAnchor and thus can itself be used as parent anchor for other\n  positions.) This way you can tie multiple items together. If the QCPItemPosition has a parent, the\n  coordinates set with \\ref setCoords are considered to be absolute values in the reference frame of the\n  parent anchor, where (0, 0) means directly ontop of the parent anchor. For example, You could attach\n  the \\a start position of a QCPItemLine to the \\a bottom anchor of a QCPItemText to make the starting\n  point of the line always be centered under the text label, no matter where the text is moved to, or is\n  itself tied to.\n\n  To set the apparent pixel position on the QCustomPlot surface directly, use \\ref setPixelPoint. This\n  works no matter what type this QCPItemPosition is or what parent-child situation it is in, as \\ref\n  setPixelPoint transforms the coordinates appropriately, to make the position appear at the specified\n  pixel values.\n*/\n\n/*!\n  Creates a new QCPItemPosition. You shouldn't create QCPItemPosition instances directly, even if\n  you want to make a new item subclass. Use \\ref QCPAbstractItem::createPosition instead, as\n  explained in the subclassing section of the QCPAbstractItem documentation.\n*/\nQCPItemPosition::QCPItemPosition(QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString name) :\n  QCPItemAnchor(parentPlot, parentItem, name),\n  mPositionType(ptAbsolute),\n  mKey(0),\n  mValue(0),\n  mParentAnchor(0)\n{\n}\n\nQCPItemPosition::~QCPItemPosition()\n{\n  // unregister as parent at children:\n  // Note: this is done in ~QCPItemAnchor again, but it's important QCPItemPosition does it itself, because only then\n  //       the setParentAnchor(0) call the correct QCPItemPosition::pixelPoint function instead of QCPItemAnchor::pixelPoint\n  QList<QCPItemPosition*> currentChildren(mChildren.toList());\n  for (int i=0; i<currentChildren.size(); ++i)\n    currentChildren.at(i)->setParentAnchor(0); // this acts back on this anchor and child removes itself from mChildren\n  // unregister as child in parent:\n  if (mParentAnchor)\n    mParentAnchor->removeChild(this);\n}\n\n/* can't make this a header inline function, because QPointer breaks with forward declared types, see QTBUG-29588 */\nQCPAxisRect *QCPItemPosition::axisRect() const\n{\n  return mAxisRect.data();\n}\n\n/*!\n  Sets the type of the position. The type defines how the coordinates passed to \\ref setCoords\n  should be handled and how the QCPItemPosition should behave in the plot.\n  \n  The possible values for \\a type can be separated in two main categories:\n\n  \\li The position is regarded as a point in plot coordinates. This corresponds to \\ref ptPlotCoords\n  and requires two axes that define the plot coordinate system. They can be specified with \\ref setAxes.\n  By default, the QCustomPlot's x- and yAxis are used.\n  \n  \\li The position is fixed on the QCustomPlot surface, i.e. independent of axis ranges. This\n  corresponds to all other types, i.e. \\ref ptAbsolute, \\ref ptViewportRatio and \\ref\n  ptAxisRectRatio. They differ only in the way the absolute position is described, see the\n  documentation of \\ref PositionType for details. For \\ref ptAxisRectRatio, note that you can specify\n  the axis rect with \\ref setAxisRect. By default this is set to the main axis rect.\n  \n  Note that the position type \\ref ptPlotCoords is only available (and sensible) when the position\n  has no parent anchor (\\ref setParentAnchor).\n  \n  If the type is changed, the apparent pixel position on the plot is preserved. This means\n  the coordinates as retrieved with coords() and set with \\ref setCoords may change in the process.\n*/\nvoid QCPItemPosition::setType(QCPItemPosition::PositionType type)\n{\n  if (mPositionType != type)\n  {\n    // if switching from or to coordinate type that isn't valid (e.g. because axes or axis rect\n    // were deleted), don't try to recover the pixelPoint() because it would output a qDebug warning.\n    bool recoverPixelPosition = true;\n    if ((mPositionType == ptPlotCoords || type == ptPlotCoords) && (!mKeyAxis || !mValueAxis))\n      recoverPixelPosition = false;\n    if ((mPositionType == ptAxisRectRatio || type == ptAxisRectRatio) && (!mAxisRect))\n      recoverPixelPosition = false;\n      \n    QPointF pixelP;\n    if (recoverPixelPosition)\n      pixelP = pixelPoint();\n    \n    mPositionType = type;\n    \n    if (recoverPixelPosition)\n      setPixelPoint(pixelP);\n  }\n}\n\n/*!\n  Sets the parent of this QCPItemPosition to \\a parentAnchor. This means the position will now\n  follow any position changes of the anchor. The local coordinate system of positions with a parent\n  anchor always is absolute with (0, 0) being exactly on top of the parent anchor. (Hence the type\n  shouldn't be \\ref ptPlotCoords for positions with parent anchors.)\n  \n  if \\a keepPixelPosition is true, the current pixel position of the QCPItemPosition is preserved\n  during reparenting. If it's set to false, the coordinates are set to (0, 0), i.e. the position\n  will be exactly on top of the parent anchor.\n  \n  To remove this QCPItemPosition from any parent anchor, set \\a parentAnchor to 0.\n  \n  If the QCPItemPosition previously had no parent and the type is \\ref ptPlotCoords, the type is\n  set to \\ref ptAbsolute, to keep the position in a valid state.\n*/\nbool QCPItemPosition::setParentAnchor(QCPItemAnchor *parentAnchor, bool keepPixelPosition)\n{\n  // make sure self is not assigned as parent:\n  if (parentAnchor == this)\n  {\n    qDebug() << Q_FUNC_INFO << \"can't set self as parent anchor\" << reinterpret_cast<quintptr>(parentAnchor);\n    return false;\n  }\n  // make sure no recursive parent-child-relationships are created:\n  QCPItemAnchor *currentParent = parentAnchor;\n  while (currentParent)\n  {\n    if (QCPItemPosition *currentParentPos = currentParent->toQCPItemPosition())\n    {\n      // is a QCPItemPosition, might have further parent, so keep iterating\n      if (currentParentPos == this)\n      {\n        qDebug() << Q_FUNC_INFO << \"can't create recursive parent-child-relationship\" << reinterpret_cast<quintptr>(parentAnchor);\n        return false;\n      }\n      currentParent = currentParentPos->mParentAnchor;\n    } else\n    {\n      // is a QCPItemAnchor, can't have further parent. Now make sure the parent items aren't the\n      // same, to prevent a position being child of an anchor which itself depends on the position,\n      // because they're both on the same item:\n      if (currentParent->mParentItem == mParentItem)\n      {\n        qDebug() << Q_FUNC_INFO << \"can't set parent to be an anchor which itself depends on this position\" << reinterpret_cast<quintptr>(parentAnchor);\n        return false;\n      }\n      break;\n    }\n  }\n  \n  // if previously no parent set and PosType is still ptPlotCoords, set to ptAbsolute:\n  if (!mParentAnchor && mPositionType == ptPlotCoords)\n    setType(ptAbsolute);\n  \n  // save pixel position:\n  QPointF pixelP;\n  if (keepPixelPosition)\n    pixelP = pixelPoint();\n  // unregister at current parent anchor:\n  if (mParentAnchor)\n    mParentAnchor->removeChild(this);\n  // register at new parent anchor:\n  if (parentAnchor)\n    parentAnchor->addChild(this);\n  mParentAnchor = parentAnchor;\n  // restore pixel position under new parent:\n  if (keepPixelPosition)\n    setPixelPoint(pixelP);\n  else\n    setCoords(0, 0);\n  return true;\n}\n\n/*!\n  Sets the coordinates of this QCPItemPosition. What the coordinates mean, is defined by the type\n  (\\ref setType).\n  \n  For example, if the type is \\ref ptAbsolute, \\a key and \\a value mean the x and y pixel position\n  on the QCustomPlot surface. In that case the origin (0, 0) is in the top left corner of the\n  QCustomPlot viewport. If the type is \\ref ptPlotCoords, \\a key and \\a value mean a point in the\n  plot coordinate system defined by the axes set by \\ref setAxes. By default those are the\n  QCustomPlot's xAxis and yAxis. See the documentation of \\ref setType for other available\n  coordinate types and their meaning.\n\n  \\see setPixelPoint\n*/\nvoid QCPItemPosition::setCoords(double key, double value)\n{\n  mKey = key;\n  mValue = value;\n}\n\n/*! \\overload\n\n  Sets the coordinates as a QPointF \\a pos where pos.x has the meaning of \\a key and pos.y the\n  meaning of \\a value of the \\ref setCoords(double key, double value) method.\n*/\nvoid QCPItemPosition::setCoords(const QPointF &pos)\n{\n  setCoords(pos.x(), pos.y());\n}\n\n/*!\n  Returns the final absolute pixel position of the QCPItemPosition on the QCustomPlot surface. It\n  includes all effects of type (\\ref setType) and possible parent anchors (\\ref setParentAnchor).\n\n  \\see setPixelPoint\n*/\nQPointF QCPItemPosition::pixelPoint() const\n{\n  switch (mPositionType)\n  {\n    case ptAbsolute:\n    {\n      if (mParentAnchor)\n        return QPointF(mKey, mValue) + mParentAnchor->pixelPoint();\n      else\n        return QPointF(mKey, mValue);\n    }\n    \n    case ptViewportRatio:\n    {\n      if (mParentAnchor)\n      {\n        return QPointF(mKey*mParentPlot->viewport().width(),\n                       mValue*mParentPlot->viewport().height()) + mParentAnchor->pixelPoint();\n      } else\n      {\n        return QPointF(mKey*mParentPlot->viewport().width(),\n                       mValue*mParentPlot->viewport().height()) + mParentPlot->viewport().topLeft();\n      }\n    }\n      \n    case ptAxisRectRatio:\n    {\n      if (mAxisRect)\n      {\n        if (mParentAnchor)\n        {\n          return QPointF(mKey*mAxisRect.data()->width(),\n                         mValue*mAxisRect.data()->height()) + mParentAnchor->pixelPoint();\n        } else\n        {\n          return QPointF(mKey*mAxisRect.data()->width(),\n                       mValue*mAxisRect.data()->height()) + mAxisRect.data()->topLeft();\n        }\n      } else\n      {\n        qDebug() << Q_FUNC_INFO << \"No axis rect defined\";\n        return QPointF(mKey, mValue);\n      }\n    }\n    \n    case ptPlotCoords:\n    {\n      double x, y;\n      if (mKeyAxis && mValueAxis)\n      {\n        // both key and value axis are given, translate key/value to x/y coordinates:\n        if (mKeyAxis.data()->orientation() == Qt::Horizontal)\n        {\n          x = mKeyAxis.data()->coordToPixel(mKey);\n          y = mValueAxis.data()->coordToPixel(mValue);\n        } else\n        {\n          y = mKeyAxis.data()->coordToPixel(mKey);\n          x = mValueAxis.data()->coordToPixel(mValue);\n        }\n      } else if (mKeyAxis)\n      {\n        // only key axis is given, depending on orientation only transform x or y to key coordinate, other stays pixel:\n        if (mKeyAxis.data()->orientation() == Qt::Horizontal)\n        {\n          x = mKeyAxis.data()->coordToPixel(mKey);\n          y = mValue;\n        } else\n        {\n          y = mKeyAxis.data()->coordToPixel(mKey);\n          x = mValue;\n        }\n      } else if (mValueAxis)\n      {\n        // only value axis is given, depending on orientation only transform x or y to value coordinate, other stays pixel:\n        if (mValueAxis.data()->orientation() == Qt::Horizontal)\n        {\n          x = mValueAxis.data()->coordToPixel(mValue);\n          y = mKey;\n        } else\n        {\n          y = mValueAxis.data()->coordToPixel(mValue);\n          x = mKey;\n        }\n      } else\n      {\n        // no axis given, basically the same as if mPositionType were ptAbsolute\n        qDebug() << Q_FUNC_INFO << \"No axes defined\";\n        x = mKey;\n        y = mValue;\n      }\n      return QPointF(x, y);\n    }\n  }\n  return QPointF();\n}\n\n/*!\n  When \\ref setType is \\ref ptPlotCoords, this function may be used to specify the axes the\n  coordinates set with \\ref setCoords relate to. By default they are set to the initial xAxis and\n  yAxis of the QCustomPlot.\n*/\nvoid QCPItemPosition::setAxes(QCPAxis *keyAxis, QCPAxis *valueAxis)\n{\n  mKeyAxis = keyAxis;\n  mValueAxis = valueAxis;\n}\n\n/*!\n  When \\ref setType is \\ref ptAxisRectRatio, this function may be used to specify the axis rect the\n  coordinates set with \\ref setCoords relate to. By default this is set to the main axis rect of\n  the QCustomPlot.\n*/\nvoid QCPItemPosition::setAxisRect(QCPAxisRect *axisRect)\n{\n  mAxisRect = axisRect;\n}\n\n/*!\n  Sets the apparent pixel position. This works no matter what type (\\ref setType) this\n  QCPItemPosition is or what parent-child situation it is in, as coordinates are transformed\n  appropriately, to make the position finally appear at the specified pixel values.\n\n  Only if the type is \\ref ptAbsolute and no parent anchor is set, this function's effect is\n  identical to that of \\ref setCoords.\n\n  \\see pixelPoint, setCoords\n*/\nvoid QCPItemPosition::setPixelPoint(const QPointF &pixelPoint)\n{\n  switch (mPositionType)\n  {\n    case ptAbsolute:\n    {\n      if (mParentAnchor)\n        setCoords(pixelPoint-mParentAnchor->pixelPoint());\n      else\n        setCoords(pixelPoint);\n      break;\n    }\n      \n    case ptViewportRatio:\n    {\n      if (mParentAnchor)\n      {\n        QPointF p(pixelPoint-mParentAnchor->pixelPoint());\n        p.rx() /= (double)mParentPlot->viewport().width();\n        p.ry() /= (double)mParentPlot->viewport().height();\n        setCoords(p);\n      } else\n      {\n        QPointF p(pixelPoint-mParentPlot->viewport().topLeft());\n        p.rx() /= (double)mParentPlot->viewport().width();\n        p.ry() /= (double)mParentPlot->viewport().height();\n        setCoords(p);\n      }\n      break;\n    }\n      \n    case ptAxisRectRatio:\n    {\n      if (mAxisRect)\n      {\n        if (mParentAnchor)\n        {\n          QPointF p(pixelPoint-mParentAnchor->pixelPoint());\n          p.rx() /= (double)mAxisRect.data()->width();\n          p.ry() /= (double)mAxisRect.data()->height();\n          setCoords(p);\n        } else\n        {\n          QPointF p(pixelPoint-mAxisRect.data()->topLeft());\n          p.rx() /= (double)mAxisRect.data()->width();\n          p.ry() /= (double)mAxisRect.data()->height();\n          setCoords(p);\n        }\n      } else\n      {\n        qDebug() << Q_FUNC_INFO << \"No axis rect defined\";\n        setCoords(pixelPoint);\n      }\n      break;\n    }\n      \n    case ptPlotCoords:\n    {\n      double newKey, newValue;\n      if (mKeyAxis && mValueAxis)\n      {\n        // both key and value axis are given, translate point to key/value coordinates:\n        if (mKeyAxis.data()->orientation() == Qt::Horizontal)\n        {\n          newKey = mKeyAxis.data()->pixelToCoord(pixelPoint.x());\n          newValue = mValueAxis.data()->pixelToCoord(pixelPoint.y());\n        } else\n        {\n          newKey = mKeyAxis.data()->pixelToCoord(pixelPoint.y());\n          newValue = mValueAxis.data()->pixelToCoord(pixelPoint.x());\n        }\n      } else if (mKeyAxis)\n      {\n        // only key axis is given, depending on orientation only transform x or y to key coordinate, other stays pixel:\n        if (mKeyAxis.data()->orientation() == Qt::Horizontal)\n        {\n          newKey = mKeyAxis.data()->pixelToCoord(pixelPoint.x());\n          newValue = pixelPoint.y();\n        } else\n        {\n          newKey = mKeyAxis.data()->pixelToCoord(pixelPoint.y());\n          newValue = pixelPoint.x();\n        }\n      } else if (mValueAxis)\n      {\n        // only value axis is given, depending on orientation only transform x or y to value coordinate, other stays pixel:\n        if (mValueAxis.data()->orientation() == Qt::Horizontal)\n        {\n          newKey = pixelPoint.y();\n          newValue = mValueAxis.data()->pixelToCoord(pixelPoint.x());\n        } else\n        {\n          newKey = pixelPoint.x();\n          newValue = mValueAxis.data()->pixelToCoord(pixelPoint.y());\n        }\n      } else\n      {\n        // no axis given, basically the same as if mPositionType were ptAbsolute\n        qDebug() << Q_FUNC_INFO << \"No axes defined\";\n        newKey = pixelPoint.x();\n        newValue = pixelPoint.y();\n      }\n      setCoords(newKey, newValue);\n      break;\n    }\n  }\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPAbstractItem\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPAbstractItem\n  \\brief The abstract base class for all items in a plot.\n  \n  In QCustomPlot, items are supplemental graphical elements that are neither plottables\n  (QCPAbstractPlottable) nor axes (QCPAxis). While plottables are always tied to two axes and thus\n  plot coordinates, items can also be placed in absolute coordinates independent of any axes. Each\n  specific item has at least one QCPItemPosition member which controls the positioning. Some items\n  are defined by more than one coordinate and thus have two or more QCPItemPosition members (For\n  example, QCPItemRect has \\a topLeft and \\a bottomRight).\n  \n  This abstract base class defines a very basic interface like visibility and clipping. Since this\n  class is abstract, it can't be instantiated. Use one of the subclasses or create a subclass\n  yourself to create new items.\n  \n  The built-in items are:\n  <table>\n  <tr><td>QCPItemLine</td><td>A line defined by a start and an end point. May have different ending styles on each side (e.g. arrows).</td></tr>\n  <tr><td>QCPItemStraightLine</td><td>A straight line defined by a start and a direction point. Unlike QCPItemLine, the straight line is infinitely long and has no endings.</td></tr>\n  <tr><td>QCPItemCurve</td><td>A curve defined by start, end and two intermediate control points. May have different ending styles on each side (e.g. arrows).</td></tr>\n  <tr><td>QCPItemRect</td><td>A rectangle</td></tr>\n  <tr><td>QCPItemEllipse</td><td>An ellipse</td></tr>\n  <tr><td>QCPItemPixmap</td><td>An arbitrary pixmap</td></tr>\n  <tr><td>QCPItemText</td><td>A text label</td></tr>\n  <tr><td>QCPItemBracket</td><td>A bracket which may be used to reference/highlight certain parts in the plot.</td></tr>\n  <tr><td>QCPItemTracer</td><td>An item that can be attached to a QCPGraph and sticks to its data points, given a key coordinate.</td></tr>\n  </table>\n  \n  Items are by default clipped to the main axis rect. To make an item visible outside that axis\n  rect, disable clipping via \\ref setClipToAxisRect.\n  \n  \\section items-using Using items\n  \n  First you instantiate the item you want to use and add it to the plot:\n  \\code\n  QCPItemLine *line = new QCPItemLine(customPlot);\n  customPlot->addItem(line);\n  \\endcode\n  by default, the positions of the item are bound to the x- and y-Axis of the plot. So we can just\n  set the plot coordinates where the line should start/end:\n  \\code\n  line->start->setCoords(-0.1, 0.8);\n  line->end->setCoords(1.1, 0.2);\n  \\endcode\n  If we don't want the line to be positioned in plot coordinates but a different coordinate system,\n  e.g. absolute pixel positions on the QCustomPlot surface, we need to change the position type like this:\n  \\code\n  line->start->setType(QCPItemPosition::ptAbsolute);\n  line->end->setType(QCPItemPosition::ptAbsolute);\n  \\endcode\n  Then we can set the coordinates, this time in pixels:\n  \\code\n  line->start->setCoords(100, 200);\n  line->end->setCoords(450, 320);\n  \\endcode\n  \n  \\section items-subclassing Creating own items\n  \n  To create an own item, you implement a subclass of QCPAbstractItem. These are the pure\n  virtual functions, you must implement:\n  \\li \\ref selectTest\n  \\li \\ref draw\n  \n  See the documentation of those functions for what they need to do.\n  \n  \\subsection items-positioning Allowing the item to be positioned\n  \n  As mentioned, item positions are represented by QCPItemPosition members. Let's assume the new item shall\n  have only one point as its position (as opposed to two like a rect or multiple like a polygon). You then add\n  a public member of type QCPItemPosition like so:\n  \n  \\code QCPItemPosition * const myPosition;\\endcode\n  \n  the const makes sure the pointer itself can't be modified from the user of your new item (the QCPItemPosition\n  instance it points to, can be modified, of course).\n  The initialization of this pointer is made easy with the \\ref createPosition function. Just assign\n  the return value of this function to each QCPItemPosition in the constructor of your item. \\ref createPosition\n  takes a string which is the name of the position, typically this is identical to the variable name.\n  For example, the constructor of QCPItemExample could look like this:\n  \n  \\code\n  QCPItemExample::QCPItemExample(QCustomPlot *parentPlot) :\n    QCPAbstractItem(parentPlot),\n    myPosition(createPosition(\"myPosition\"))\n  {\n    // other constructor code\n  }\n  \\endcode\n  \n  \\subsection items-drawing The draw function\n  \n  To give your item a visual representation, reimplement the \\ref draw function and use the passed\n  QCPPainter to draw the item. You can retrieve the item position in pixel coordinates from the\n  position member(s) via \\ref QCPItemPosition::pixelPoint.\n\n  To optimize performance you should calculate a bounding rect first (don't forget to take the pen\n  width into account), check whether it intersects the \\ref clipRect, and only draw the item at all\n  if this is the case.\n  \n  \\subsection items-selection The selectTest function\n  \n  Your implementation of the \\ref selectTest function may use the helpers \\ref distSqrToLine and\n  \\ref rectSelectTest. With these, the implementation of the selection test becomes significantly\n  simpler for most items. See the documentation of \\ref selectTest for what the function parameters\n  mean and what the function should return.\n  \n  \\subsection anchors Providing anchors\n  \n  Providing anchors (QCPItemAnchor) starts off like adding a position. First you create a public\n  member, e.g.\n  \n  \\code QCPItemAnchor * const bottom;\\endcode\n\n  and create it in the constructor with the \\ref createAnchor function, assigning it a name and an\n  anchor id (an integer enumerating all anchors on the item, you may create an own enum for this).\n  Since anchors can be placed anywhere, relative to the item's position(s), your item needs to\n  provide the position of every anchor with the reimplementation of the \\ref anchorPixelPoint(int\n  anchorId) function.\n  \n  In essence the QCPItemAnchor is merely an intermediary that itself asks your item for the pixel\n  position when anything attached to the anchor needs to know the coordinates.\n*/\n\n/* start of documentation of inline functions */\n\n/*! \\fn QList<QCPItemPosition*> QCPAbstractItem::positions() const\n  \n  Returns all positions of the item in a list.\n  \n  \\see anchors, position\n*/\n\n/*! \\fn QList<QCPItemAnchor*> QCPAbstractItem::anchors() const\n  \n  Returns all anchors of the item in a list. Note that since a position (QCPItemPosition) is always\n  also an anchor, the list will also contain the positions of this item.\n  \n  \\see positions, anchor\n*/\n\n/* end of documentation of inline functions */\n/* start documentation of pure virtual functions */\n\n/*! \\fn void QCPAbstractItem::draw(QCPPainter *painter) = 0\n  \\internal\n  \n  Draws this item with the provided \\a painter.\n  \n  The cliprect of the provided painter is set to the rect returned by \\ref clipRect before this\n  function is called. The clipRect depends on the clipping settings defined by \\ref\n  setClipToAxisRect and \\ref setClipAxisRect.\n*/\n\n/* end documentation of pure virtual functions */\n/* start documentation of signals */\n\n/*! \\fn void QCPAbstractItem::selectionChanged(bool selected)\n  This signal is emitted when the selection state of this item has changed, either by user interaction\n  or by a direct call to \\ref setSelected.\n*/\n\n/* end documentation of signals */\n\n/*!\n  Base class constructor which initializes base class members.\n*/\nQCPAbstractItem::QCPAbstractItem(QCustomPlot *parentPlot) :\n  QCPLayerable(parentPlot),\n  mClipToAxisRect(false),\n  mSelectable(true),\n  mSelected(false)\n{\n  QList<QCPAxisRect*> rects = parentPlot->axisRects();\n  if (rects.size() > 0)\n  {\n    setClipToAxisRect(true);\n    setClipAxisRect(rects.first());\n  }\n}\n\nQCPAbstractItem::~QCPAbstractItem()\n{\n  // don't delete mPositions because every position is also an anchor and thus in mAnchors\n  qDeleteAll(mAnchors);\n}\n\n/* can't make this a header inline function, because QPointer breaks with forward declared types, see QTBUG-29588 */\nQCPAxisRect *QCPAbstractItem::clipAxisRect() const\n{\n  return mClipAxisRect.data();\n}\n\n/*!\n  Sets whether the item shall be clipped to an axis rect or whether it shall be visible on the\n  entire QCustomPlot. The axis rect can be set with \\ref setClipAxisRect.\n  \n  \\see setClipAxisRect\n*/\nvoid QCPAbstractItem::setClipToAxisRect(bool clip)\n{\n  mClipToAxisRect = clip;\n  if (mClipToAxisRect)\n    setParentLayerable(mClipAxisRect.data());\n}\n\n/*!\n  Sets the clip axis rect. It defines the rect that will be used to clip the item when \\ref\n  setClipToAxisRect is set to true.\n  \n  \\see setClipToAxisRect\n*/\nvoid QCPAbstractItem::setClipAxisRect(QCPAxisRect *rect)\n{\n  mClipAxisRect = rect;\n  if (mClipToAxisRect)\n    setParentLayerable(mClipAxisRect.data());\n}\n\n/*!\n  Sets whether the user can (de-)select this item by clicking on the QCustomPlot surface.\n  (When \\ref QCustomPlot::setInteractions contains QCustomPlot::iSelectItems.)\n  \n  However, even when \\a selectable was set to false, it is possible to set the selection manually,\n  by calling \\ref setSelected.\n  \n  \\see QCustomPlot::setInteractions, setSelected\n*/\nvoid QCPAbstractItem::setSelectable(bool selectable)\n{\n  if (mSelectable != selectable)\n  {\n    mSelectable = selectable;\n    emit selectableChanged(mSelectable);\n  }\n}\n\n/*!\n  Sets whether this item is selected or not. When selected, it might use a different visual\n  appearance (e.g. pen and brush), this depends on the specific item though.\n\n  The entire selection mechanism for items is handled automatically when \\ref\n  QCustomPlot::setInteractions contains QCustomPlot::iSelectItems. You only need to call this\n  function when you wish to change the selection state manually.\n  \n  This function can change the selection state even when \\ref setSelectable was set to false.\n  \n  emits the \\ref selectionChanged signal when \\a selected is different from the previous selection state.\n  \n  \\see setSelectable, selectTest\n*/\nvoid QCPAbstractItem::setSelected(bool selected)\n{\n  if (mSelected != selected)\n  {\n    mSelected = selected;\n    emit selectionChanged(mSelected);\n  }\n}\n\n/*!\n  Returns the QCPItemPosition with the specified \\a name. If this item doesn't have a position by\n  that name, returns 0.\n  \n  This function provides an alternative way to access item positions. Normally, you access\n  positions direcly by their member pointers (which typically have the same variable name as \\a\n  name).\n  \n  \\see positions, anchor\n*/\nQCPItemPosition *QCPAbstractItem::position(const QString &name) const\n{\n  for (int i=0; i<mPositions.size(); ++i)\n  {\n    if (mPositions.at(i)->name() == name)\n      return mPositions.at(i);\n  }\n  qDebug() << Q_FUNC_INFO << \"position with name not found:\" << name;\n  return 0;\n}\n\n/*!\n  Returns the QCPItemAnchor with the specified \\a name. If this item doesn't have an anchor by\n  that name, returns 0.\n  \n  This function provides an alternative way to access item anchors. Normally, you access\n  anchors direcly by their member pointers (which typically have the same variable name as \\a\n  name).\n  \n  \\see anchors, position\n*/\nQCPItemAnchor *QCPAbstractItem::anchor(const QString &name) const\n{\n  for (int i=0; i<mAnchors.size(); ++i)\n  {\n    if (mAnchors.at(i)->name() == name)\n      return mAnchors.at(i);\n  }\n  qDebug() << Q_FUNC_INFO << \"anchor with name not found:\" << name;\n  return 0;\n}\n\n/*!\n  Returns whether this item has an anchor with the specified \\a name.\n  \n  Note that you can check for positions with this function, too. This is because every position is\n  also an anchor (QCPItemPosition inherits from QCPItemAnchor).\n  \n  \\see anchor, position\n*/\nbool QCPAbstractItem::hasAnchor(const QString &name) const\n{\n  for (int i=0; i<mAnchors.size(); ++i)\n  {\n    if (mAnchors.at(i)->name() == name)\n      return true;\n  }\n  return false;\n}\n\n/*! \\internal\n  \n  Returns the rect the visual representation of this item is clipped to. This depends on the\n  current setting of \\ref setClipToAxisRect as well as the axis rect set with \\ref setClipAxisRect.\n  \n  If the item is not clipped to an axis rect, the \\ref QCustomPlot::viewport rect is returned.\n  \n  \\see draw\n*/\nQRect QCPAbstractItem::clipRect() const\n{\n  if (mClipToAxisRect && mClipAxisRect)\n    return mClipAxisRect.data()->rect();\n  else\n    return mParentPlot->viewport();\n}\n\n/*! \\internal\n\n  A convenience function to easily set the QPainter::Antialiased hint on the provided \\a painter\n  before drawing item lines.\n\n  This is the antialiasing state the painter passed to the \\ref draw method is in by default.\n  \n  This function takes into account the local setting of the antialiasing flag as well as the\n  overrides set with \\ref QCustomPlot::setAntialiasedElements and \\ref\n  QCustomPlot::setNotAntialiasedElements.\n  \n  \\see setAntialiased\n*/\nvoid QCPAbstractItem::applyDefaultAntialiasingHint(QCPPainter *painter) const\n{\n  applyAntialiasingHint(painter, mAntialiased, QCP::aeItems);\n}\n\n/*! \\internal\n\n  Finds the shortest squared distance of \\a point to the line segment defined by \\a start and \\a\n  end.\n  \n  This function may be used to help with the implementation of the \\ref selectTest function for\n  specific items.\n  \n  \\note This function is identical to QCPAbstractPlottable::distSqrToLine\n  \n  \\see rectSelectTest\n*/\ndouble QCPAbstractItem::distSqrToLine(const QPointF &start, const QPointF &end, const QPointF &point) const\n{\n  QVector2D a(start);\n  QVector2D b(end);\n  QVector2D p(point);\n  QVector2D v(b-a);\n  \n  double vLengthSqr = v.lengthSquared();\n  if (!qFuzzyIsNull(vLengthSqr))\n  {\n    double mu = QVector2D::dotProduct(p-a, v)/vLengthSqr;\n    if (mu < 0)\n      return (a-p).lengthSquared();\n    else if (mu > 1)\n      return (b-p).lengthSquared();\n    else\n      return ((a + mu*v)-p).lengthSquared();\n  } else\n    return (a-p).lengthSquared();\n}\n\n/*! \\internal\n\n  A convenience function which returns the selectTest value for a specified \\a rect and a specified\n  click position \\a pos. \\a filledRect defines whether a click inside the rect should also be\n  considered a hit or whether only the rect border is sensitive to hits.\n  \n  This function may be used to help with the implementation of the \\ref selectTest function for\n  specific items.\n  \n  For example, if your item consists of four rects, call this function four times, once for each\n  rect, in your \\ref selectTest reimplementation. Finally, return the minimum of all four returned\n  values which were greater or equal to zero. (Because this function may return -1.0 when \\a pos\n  doesn't hit \\a rect at all). If all calls returned -1.0, return -1.0, too, because your item\n  wasn't hit.\n  \n  \\see distSqrToLine\n*/\ndouble QCPAbstractItem::rectSelectTest(const QRectF &rect, const QPointF &pos, bool filledRect) const\n{\n  double result = -1;\n\n  // distance to border:\n  QList<QLineF> lines;\n  lines << QLineF(rect.topLeft(), rect.topRight()) << QLineF(rect.bottomLeft(), rect.bottomRight())\n        << QLineF(rect.topLeft(), rect.bottomLeft()) << QLineF(rect.topRight(), rect.bottomRight());\n  double minDistSqr = std::numeric_limits<double>::max();\n  for (int i=0; i<lines.size(); ++i)\n  {\n    double distSqr = distSqrToLine(lines.at(i).p1(), lines.at(i).p2(), pos);\n    if (distSqr < minDistSqr)\n      minDistSqr = distSqr;\n  }\n  result = qSqrt(minDistSqr);\n  \n  // filled rect, allow click inside to count as hit:\n  if (filledRect && result > mParentPlot->selectionTolerance()*0.99)\n  {\n    if (rect.contains(pos))\n      result = mParentPlot->selectionTolerance()*0.99;\n  }\n  return result;\n}\n\n/*! \\internal\n\n  Returns the pixel position of the anchor with Id \\a anchorId. This function must be reimplemented in\n  item subclasses if they want to provide anchors (QCPItemAnchor).\n  \n  For example, if the item has two anchors with id 0 and 1, this function takes one of these anchor\n  ids and returns the respective pixel points of the specified anchor.\n  \n  \\see createAnchor\n*/\nQPointF QCPAbstractItem::anchorPixelPoint(int anchorId) const\n{\n  qDebug() << Q_FUNC_INFO << \"called on item which shouldn't have any anchors (this method not reimplemented). anchorId\" << anchorId;\n  return QPointF();\n}\n\n/*! \\internal\n\n  Creates a QCPItemPosition, registers it with this item and returns a pointer to it. The specified\n  \\a name must be a unique string that is usually identical to the variable name of the position\n  member (This is needed to provide the name-based \\ref position access to positions).\n  \n  Don't delete positions created by this function manually, as the item will take care of it.\n  \n  Use this function in the constructor (initialization list) of the specific item subclass to\n  create each position member. Don't create QCPItemPositions with \\b new yourself, because they\n  won't be registered with the item properly.\n  \n  \\see createAnchor\n*/\nQCPItemPosition *QCPAbstractItem::createPosition(const QString &name)\n{\n  if (hasAnchor(name))\n    qDebug() << Q_FUNC_INFO << \"anchor/position with name exists already:\" << name;\n  QCPItemPosition *newPosition = new QCPItemPosition(mParentPlot, this, name);\n  mPositions.append(newPosition);\n  mAnchors.append(newPosition); // every position is also an anchor\n  newPosition->setAxes(mParentPlot->xAxis, mParentPlot->yAxis);\n  newPosition->setType(QCPItemPosition::ptPlotCoords);\n  if (mParentPlot->axisRect())\n    newPosition->setAxisRect(mParentPlot->axisRect());\n  newPosition->setCoords(0, 0);\n  return newPosition;\n}\n\n/*! \\internal\n\n  Creates a QCPItemAnchor, registers it with this item and returns a pointer to it. The specified\n  \\a name must be a unique string that is usually identical to the variable name of the anchor\n  member (This is needed to provide the name based \\ref anchor access to anchors).\n  \n  The \\a anchorId must be a number identifying the created anchor. It is recommended to create an\n  enum (e.g. \"AnchorIndex\") for this on each item that uses anchors. This id is used by the anchor\n  to identify itself when it calls QCPAbstractItem::anchorPixelPoint. That function then returns\n  the correct pixel coordinates for the passed anchor id.\n  \n  Don't delete anchors created by this function manually, as the item will take care of it.\n  \n  Use this function in the constructor (initialization list) of the specific item subclass to\n  create each anchor member. Don't create QCPItemAnchors with \\b new yourself, because then they\n  won't be registered with the item properly.\n  \n  \\see createPosition\n*/\nQCPItemAnchor *QCPAbstractItem::createAnchor(const QString &name, int anchorId)\n{\n  if (hasAnchor(name))\n    qDebug() << Q_FUNC_INFO << \"anchor/position with name exists already:\" << name;\n  QCPItemAnchor *newAnchor = new QCPItemAnchor(mParentPlot, this, name, anchorId);\n  mAnchors.append(newAnchor);\n  return newAnchor;\n}\n\n/* inherits documentation from base class */\nvoid QCPAbstractItem::selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)\n{\n  Q_UNUSED(event)\n  Q_UNUSED(details)\n  if (mSelectable)\n  {\n    bool selBefore = mSelected;\n    setSelected(additive ? !mSelected : true);\n    if (selectionStateChanged)\n      *selectionStateChanged = mSelected != selBefore;\n  }\n}\n\n/* inherits documentation from base class */\nvoid QCPAbstractItem::deselectEvent(bool *selectionStateChanged)\n{\n  if (mSelectable)\n  {\n    bool selBefore = mSelected;\n    setSelected(false);\n    if (selectionStateChanged)\n      *selectionStateChanged = mSelected != selBefore;\n  }\n}\n\n/* inherits documentation from base class */\nQCP::Interaction QCPAbstractItem::selectionCategory() const\n{\n  return QCP::iSelectItems;\n}\n\n\n/*! \\file */\n\n\n\n/*! \\mainpage %QCustomPlot 1.2.1 Documentation\n\n  \\image html qcp-doc-logo.png\n  \n  Below is a brief overview of and guide to the classes and their relations. If you are new to\n  QCustomPlot and just want to start using it, it's recommended to look at the tutorials and\n  examples at\n \n  http://www.qcustomplot.com/\n \n  This documentation is especially helpful as a reference, when you're familiar with the basic\n  concept of how to use %QCustomPlot and you wish to learn more about specific functionality.\n  See the \\ref classoverview \"class overview\" for diagrams explaining the relationships between\n  the most important classes of the QCustomPlot library.\n  \n  The central widget which displays the plottables and axes on its surface is QCustomPlot. Every\n  QCustomPlot contains four axes by default. They can be accessed via the members \\ref\n  QCustomPlot::xAxis \"xAxis\", \\ref QCustomPlot::yAxis \"yAxis\", \\ref QCustomPlot::xAxis2 \"xAxis2\"\n  and \\ref QCustomPlot::yAxis2 \"yAxis2\", and are of type QCPAxis. QCustomPlot supports an arbitrary\n  number of axes and axis rects, see the documentation of QCPAxisRect for details.\n\n  \\section mainpage-plottables Plottables\n  \n  \\a Plottables are classes that display any kind of data inside the QCustomPlot. They all derive\n  from QCPAbstractPlottable. For example, the QCPGraph class is a plottable that displays a graph\n  inside the plot with different line styles, scatter styles, filling etc.\n  \n  Since plotting graphs is such a dominant use case, QCustomPlot has a special interface for working\n  with QCPGraph plottables, that makes it very easy to handle them:\\n\n  You create a new graph with QCustomPlot::addGraph and access them with QCustomPlot::graph.\n  \n  For all other plottables, you need to use the normal plottable interface:\\n\n  First, you create an instance of the plottable you want, e.g.\n  \\code\n  QCPCurve *newCurve = new QCPCurve(customPlot->xAxis, customPlot->yAxis);\\endcode\n  add it to the customPlot:\n  \\code\n  customPlot->addPlottable(newCurve);\\endcode\n  and then modify the properties of the newly created plottable via the <tt>newCurve</tt> pointer.\n  \n  Plottables (including graphs) can be retrieved via QCustomPlot::plottable. Since the return type\n  of that function is the abstract base class of all plottables, QCPAbstractPlottable, you will\n  probably want to qobject_cast the returned pointer to the respective plottable subclass. (As\n  usual, if the cast returns zero, the plottable wasn't of that specific subclass.)\n  \n  All further interfacing with plottables (e.g how to set data) is specific to the plottable type.\n  See the documentations of the subclasses: QCPGraph, QCPCurve, QCPBars, QCPStatisticalBox,\n  QCPColorMap.\n\n  \\section mainpage-axes Controlling the Axes\n  \n  As mentioned, QCustomPlot has four axes by default: \\a xAxis (bottom), \\a yAxis (left), \\a xAxis2\n  (top), \\a yAxis2 (right).\n  \n  Their range is handled by the simple QCPRange class. You can set the range with the\n  QCPAxis::setRange function. By default, the axes represent a linear scale. To set a logarithmic\n  scale, set \\ref QCPAxis::setScaleType to \\ref QCPAxis::stLogarithmic. The logarithm base can be set freely\n  with \\ref QCPAxis::setScaleLogBase.\n  \n  By default, an axis automatically creates and labels ticks in a sensible manner. See the\n  following functions for tick manipulation:\\n QCPAxis::setTicks, QCPAxis::setAutoTicks,\n  QCPAxis::setAutoTickCount, QCPAxis::setAutoTickStep, QCPAxis::setTickLabels,\n  QCPAxis::setTickLabelType, QCPAxis::setTickLabelRotation, QCPAxis::setTickStep,\n  QCPAxis::setTickLength,...\n  \n  Each axis can be given an axis label (e.g. \"Voltage (mV)\") with QCPAxis::setLabel.\n  \n  The distance of an axis backbone to the respective viewport border is called its margin.\n  Normally, the margins are calculated automatically. To change this, set\n  \\ref QCPAxisRect::setAutoMargins to exclude the respective margin sides, set the margins manually with\n  \\ref QCPAxisRect::setMargins. The main axis rect can be reached with \\ref QCustomPlot::axisRect().\n  \n  \\section mainpage-legend Plot Legend\n  \n  Every QCustomPlot has one QCPLegend (as \\ref QCustomPlot::legend) by default. A legend is a small\n  layout element inside the plot which lists the plottables with an icon of the plottable\n  line/symbol and a name (QCPAbstractPlottable::setName). Plottables can be added and removed from\n  the main legend via \\ref QCPAbstractPlottable::addToLegend and \\ref\n  QCPAbstractPlottable::removeFromLegend. By default, adding a plottable to QCustomPlot\n  automatically adds it to the legend, too. This behaviour can be modified with the\n  QCustomPlot::setAutoAddPlottableToLegend property.\n  \n  The QCPLegend provides an interface to access, add and remove legend items directly, too. See\n  QCPLegend::item, QCPLegend::itemWithPlottable, QCPLegend::addItem, QCPLegend::removeItem for\n  example.\n  \n  Multiple legends are supported via the \\link thelayoutsystem layout system\\endlink (as a\n  QCPLegend simply is a normal layout element).\n  \n  \\section mainpage-userinteraction User Interactions\n  \n  QCustomPlot supports dragging axis ranges with the mouse (\\ref\n  QCPAxisRect::setRangeDrag), zooming axis ranges with the mouse wheel (\\ref\n  QCPAxisRect::setRangeZoom) and a complete selection mechanism.\n  \n  The availability of these interactions is controlled with \\ref QCustomPlot::setInteractions. For\n  details about the interaction system, see the documentation there.\n  \n  Further, QCustomPlot always emits corresponding signals, when objects are clicked or\n  doubleClicked. See \\ref QCustomPlot::plottableClick, \\ref QCustomPlot::plottableDoubleClick\n  and \\ref QCustomPlot::axisClick for example.\n  \n  \\section mainpage-items Items\n  \n  Apart from plottables there is another category of plot objects that are important: Items. The\n  base class of all items is QCPAbstractItem. An item sets itself apart from plottables in that\n  it's not necessarily bound to any axes. This means it may also be positioned in absolute pixel\n  coordinates or placed at a relative position on an axis rect. Further, it usually doesn't\n  represent data directly, but acts as decoration, emphasis, description etc.\n  \n  Multiple items can be arranged in a parent-child-hierarchy allowing for dynamical behaviour. For\n  example, you could place the head of an arrow at a fixed plot coordinate, so it always points to\n  some important area in the plot. The tail of the arrow can be anchored to a text item which\n  always resides in the top center of the axis rect, independent of where the user drags the axis\n  ranges. This way the arrow stretches and turns so it always points from the label to the\n  specified plot coordinate, without any further code necessary.\n  \n  For a more detailed introduction, see the QCPAbstractItem documentation, and from there the\n  documentations of the individual built-in items, to find out how to use them.\n  \n  \\section mainpage-layoutelements Layout elements and layouts\n  \n  QCustomPlot uses an internal layout system to provide dynamic sizing and positioning of objects like\n  the axis rect(s), legends and the plot title. They are all based on \\ref QCPLayoutElement and are arranged by\n  placing them inside a \\ref QCPLayout.\n  \n  Details on this topic are given on the dedicated page about \\link thelayoutsystem the layout system\\endlink.\n  \n  \\section mainpage-performancetweaks Performance Tweaks\n  \n  Although QCustomPlot is quite fast, some features like translucent fills, antialiasing and thick\n  lines can cause a significant slow down. If you notice this in your application, here are some\n  thoughts on how to increase performance. By far the most time is spent in the drawing functions,\n  specifically the drawing of graphs. For maximum performance, consider the following (most\n  recommended/effective measures first):\n  \n  \\li use Qt 4.8.0 and up. Performance has doubled or tripled with respect to Qt 4.7.4. However\n  QPainter was broken and drawing pixel precise things, e.g. scatters, isn't possible with Qt >=\n  4.8.0. So it's a performance vs. plot quality tradeoff when switching to Qt 4.8.\n  \\li To increase responsiveness during dragging, consider setting \\ref QCustomPlot::setNoAntialiasingOnDrag to true.\n  \\li On X11 (GNU/Linux), avoid the slow native drawing system, use raster by supplying\n  \"-graphicssystem raster\" as command line argument or calling QApplication::setGraphicsSystem(\"raster\")\n  before creating the QApplication object. (Only available for Qt versions before 5.0)\n  \\li On all operating systems, use OpenGL hardware acceleration by supplying \"-graphicssystem\n  opengl\" as command line argument or calling QApplication::setGraphicsSystem(\"opengl\") (Only\n  available for Qt versions before 5.0). If OpenGL is available, this will slightly decrease the\n  quality of antialiasing, but extremely increase performance especially with alpha\n  (semi-transparent) fills, much antialiasing and a large QCustomPlot drawing surface. Note\n  however, that the maximum frame rate might be constrained by the vertical sync frequency of your\n  monitor (VSync can be disabled in the graphics card driver configuration). So for simple plots\n  (where the potential framerate is far above 60 frames per second), OpenGL acceleration might\n  achieve numerically lower frame rates than the other graphics systems, because they are not\n  capped at the VSync frequency.\n  \\li Avoid any kind of alpha (transparency), especially in fills\n  \\li Avoid lines with a pen width greater than one\n  \\li Avoid any kind of antialiasing, especially in graph lines (see \\ref QCustomPlot::setNotAntialiasedElements)\n  \\li Avoid repeatedly setting the complete data set with \\ref QCPGraph::setData. Use \\ref QCPGraph::addData instead, if most\n  data points stay unchanged, e.g. in a running measurement.\n  \\li Set the \\a copy parameter of the setData functions to false, so only pointers get\n  transferred. (Relevant only if preparing data maps with a large number of points, i.e. over 10000)\n  \n  \\section mainpage-flags Preprocessor Define Flags\n  \n  QCustomPlot understands some preprocessor defines that are useful for debugging and compilation:\n  <dl>\n  <dt>\\c QCUSTOMPLOT_COMPILE_LIBRARY\n  <dd>Define this flag when you compile QCustomPlot as a shared library (.so/.dll)\n  <dt>\\c QCUSTOMPLOT_USE_LIBRARY\n  <dd>Define this flag before including the header, when using QCustomPlot as a shared library\n  <dt>\\c QCUSTOMPLOT_CHECK_DATA\n  <dd>If this flag is defined, the QCustomPlot plottables will perform data validity checks on every redraw.\n      This means they will give qDebug output when you plot \\e inf or \\e nan values, they will not\n      fix your data.\n  </dl>\n\n*/\n\n/*! \\page classoverview Class Overview\n  \n  The following diagrams may help to gain a deeper understanding of the relationships between classes that make up\n  the QCustomPlot library. The diagrams are not exhaustive, so only the classes deemed most relevant are shown.\n  \n  \\section classoverview-relations Class Relationship Diagram\n  \\image html RelationOverview.png \"Overview of most important classes and their relations\"\n  \\section classoverview-inheritance Class Inheritance Tree\n  \\image html InheritanceOverview.png \"Inheritance tree of most important classes\"\n  \n*/\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCustomPlot\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCustomPlot\n  \n  \\brief The central class of the library. This is the QWidget which displays the plot and\n  interacts with the user.\n  \n  For tutorials on how to use QCustomPlot, see the website\\n\n  http://www.qcustomplot.com/\n*/\n\n/* start of documentation of inline functions */\n\n/*! \\fn QRect QCustomPlot::viewport() const\n  \n  Returns the viewport rect of this QCustomPlot instance. The viewport is the area the plot is\n  drawn in, all mechanisms, e.g. margin caluclation take the viewport to be the outer border of the\n  plot. The viewport normally is the rect() of the QCustomPlot widget, i.e. a rect with top left\n  (0, 0) and size of the QCustomPlot widget.\n  \n  Don't confuse the viewport with the axis rect (QCustomPlot::axisRect). An axis rect is typically\n  an area enclosed by four axes, where the graphs/plottables are drawn in. The viewport is larger\n  and contains also the axes themselves, their tick numbers, their labels, the plot title etc.\n  \n  Only when saving to a file (see \\ref savePng, savePdf etc.) the viewport is temporarily modified\n  to allow saving plots with sizes independent of the current widget size.\n*/\n\n/*! \\fn QCPLayoutGrid *QCustomPlot::plotLayout() const\n  \n  Returns the top level layout of this QCustomPlot instance. It is a \\ref QCPLayoutGrid, initially containing just\n  one cell with the main QCPAxisRect inside.\n*/\n\n/* end of documentation of inline functions */\n/* start of documentation of signals */\n\n/*! \\fn void QCustomPlot::mouseDoubleClick(QMouseEvent *event)\n\n  This signal is emitted when the QCustomPlot receives a mouse double click event.\n*/\n\n/*! \\fn void QCustomPlot::mousePress(QMouseEvent *event)\n\n  This signal is emitted when the QCustomPlot receives a mouse press event.\n  \n  It is emitted before QCustomPlot handles any other mechanism like range dragging. So a slot\n  connected to this signal can still influence the behaviour e.g. with \\ref QCPAxisRect::setRangeDrag or \\ref\n  QCPAxisRect::setRangeDragAxes.\n*/\n\n/*! \\fn void QCustomPlot::mouseMove(QMouseEvent *event)\n\n  This signal is emitted when the QCustomPlot receives a mouse move event.\n  \n  It is emitted before QCustomPlot handles any other mechanism like range dragging. So a slot\n  connected to this signal can still influence the behaviour e.g. with \\ref QCPAxisRect::setRangeDrag or \\ref\n  QCPAxisRect::setRangeDragAxes.\n  \n  \\warning It is discouraged to change the drag-axes with \\ref QCPAxisRect::setRangeDragAxes here,\n  because the dragging starting point was saved the moment the mouse was pressed. Thus it only has\n  a meaning for the range drag axes that were set at that moment. If you want to change the drag\n  axes, consider doing this in the \\ref mousePress signal instead.\n*/\n\n/*! \\fn void QCustomPlot::mouseRelease(QMouseEvent *event)\n\n  This signal is emitted when the QCustomPlot receives a mouse release event.\n  \n  It is emitted before QCustomPlot handles any other mechanisms like object selection. So a\n  slot connected to this signal can still influence the behaviour e.g. with \\ref setInteractions or\n  \\ref QCPAbstractPlottable::setSelectable.\n*/\n\n/*! \\fn void QCustomPlot::mouseWheel(QMouseEvent *event)\n\n  This signal is emitted when the QCustomPlot receives a mouse wheel event.\n  \n  It is emitted before QCustomPlot handles any other mechanisms like range zooming. So a slot\n  connected to this signal can still influence the behaviour e.g. with \\ref QCPAxisRect::setRangeZoom, \\ref\n  QCPAxisRect::setRangeZoomAxes or \\ref QCPAxisRect::setRangeZoomFactor.\n*/\n\n/*! \\fn void QCustomPlot::plottableClick(QCPAbstractPlottable *plottable, QMouseEvent *event)\n  \n  This signal is emitted when a plottable is clicked.\n\n  \\a event is the mouse event that caused the click and \\a plottable is the plottable that received\n  the click.\n  \n  \\see plottableDoubleClick\n*/\n\n/*! \\fn void QCustomPlot::plottableDoubleClick(QCPAbstractPlottable *plottable, QMouseEvent *event)\n  \n  This signal is emitted when a plottable is double clicked.\n  \n  \\a event is the mouse event that caused the click and \\a plottable is the plottable that received\n  the click.\n  \n  \\see plottableClick\n*/\n\n/*! \\fn void QCustomPlot::itemClick(QCPAbstractItem *item, QMouseEvent *event)\n  \n  This signal is emitted when an item is clicked.\n\n  \\a event is the mouse event that caused the click and \\a item is the item that received the\n  click.\n  \n  \\see itemDoubleClick\n*/\n\n/*! \\fn void QCustomPlot::itemDoubleClick(QCPAbstractItem *item, QMouseEvent *event)\n  \n  This signal is emitted when an item is double clicked.\n  \n  \\a event is the mouse event that caused the click and \\a item is the item that received the\n  click.\n  \n  \\see itemClick\n*/\n\n/*! \\fn void QCustomPlot::axisClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event)\n  \n  This signal is emitted when an axis is clicked.\n  \n  \\a event is the mouse event that caused the click, \\a axis is the axis that received the click and\n  \\a part indicates the part of the axis that was clicked.\n  \n  \\see axisDoubleClick\n*/\n\n/*! \\fn void QCustomPlot::axisDoubleClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event)\n\n  This signal is emitted when an axis is double clicked.\n  \n  \\a event is the mouse event that caused the click, \\a axis is the axis that received the click and\n  \\a part indicates the part of the axis that was clicked.\n  \n  \\see axisClick\n*/\n\n/*! \\fn void QCustomPlot::legendClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event)\n\n  This signal is emitted when a legend (item) is clicked.\n  \n  \\a event is the mouse event that caused the click, \\a legend is the legend that received the\n  click and \\a item is the legend item that received the click. If only the legend and no item is\n  clicked, \\a item is 0. This happens for a click inside the legend padding or the space between\n  two items.\n  \n  \\see legendDoubleClick\n*/\n\n/*! \\fn void QCustomPlot::legendDoubleClick(QCPLegend *legend,  QCPAbstractLegendItem *item, QMouseEvent *event)\n\n  This signal is emitted when a legend (item) is double clicked.\n  \n  \\a event is the mouse event that caused the click, \\a legend is the legend that received the\n  click and \\a item is the legend item that received the click. If only the legend and no item is\n  clicked, \\a item is 0. This happens for a click inside the legend padding or the space between\n  two items.\n  \n  \\see legendClick\n*/\n\n/*! \\fn void QCustomPlot:: titleClick(QMouseEvent *event, QCPPlotTitle *title)\n\n  This signal is emitted when a plot title is clicked.\n  \n  \\a event is the mouse event that caused the click and \\a title is the plot title that received\n  the click.\n  \n  \\see titleDoubleClick\n*/\n\n/*! \\fn void QCustomPlot::titleDoubleClick(QMouseEvent *event, QCPPlotTitle *title)\n\n  This signal is emitted when a plot title is double clicked.\n  \n  \\a event is the mouse event that caused the click and \\a title is the plot title that received\n  the click.\n  \n  \\see titleClick\n*/\n\n/*! \\fn void QCustomPlot::selectionChangedByUser()\n  \n  This signal is emitted after the user has changed the selection in the QCustomPlot, e.g. by\n  clicking. It is not emitted when the selection state of an object has changed programmatically by\n  a direct call to setSelected() on an object or by calling \\ref deselectAll.\n  \n  In addition to this signal, selectable objects also provide individual signals, for example\n  QCPAxis::selectionChanged or QCPAbstractPlottable::selectionChanged. Note that those signals are\n  emitted even if the selection state is changed programmatically.\n  \n  See the documentation of \\ref setInteractions for details about the selection mechanism.\n  \n  \\see selectedPlottables, selectedGraphs, selectedItems, selectedAxes, selectedLegends\n*/\n\n/*! \\fn void QCustomPlot::beforeReplot()\n  \n  This signal is emitted immediately before a replot takes place (caused by a call to the slot \\ref\n  replot).\n  \n  It is safe to mutually connect the replot slot with this signal on two QCustomPlots to make them\n  replot synchronously, it won't cause an infinite recursion.\n  \n  \\see replot, afterReplot\n*/\n\n/*! \\fn void QCustomPlot::afterReplot()\n  \n  This signal is emitted immediately after a replot has taken place (caused by a call to the slot \\ref\n  replot).\n  \n  It is safe to mutually connect the replot slot with this signal on two QCustomPlots to make them\n  replot synchronously, it won't cause an infinite recursion.\n  \n  \\see replot, beforeReplot\n*/\n\n/* end of documentation of signals */\n/* start of documentation of public members */\n\n/*! \\var QCPAxis *QCustomPlot::xAxis\n\n  A pointer to the primary x Axis (bottom) of the main axis rect of the plot.\n  \n  QCustomPlot offers convenient pointers to the axes (\\ref xAxis, \\ref yAxis, \\ref xAxis2, \\ref\n  yAxis2) and the \\ref legend. They make it very easy working with plots that only have a single\n  axis rect and at most one axis at each axis rect side. If you use \\link thelayoutsystem the\n  layout system\\endlink to add multiple axis rects or multiple axes to one side, use the \\ref\n  QCPAxisRect::axis interface to access the new axes. If one of the four default axes or the\n  default legend is removed due to manipulation of the layout system (e.g. by removing the main\n  axis rect), the corresponding pointers become 0.\n*/\n\n/*! \\var QCPAxis *QCustomPlot::yAxis\n\n  A pointer to the primary y Axis (left) of the main axis rect of the plot.\n  \n  QCustomPlot offers convenient pointers to the axes (\\ref xAxis, \\ref yAxis, \\ref xAxis2, \\ref\n  yAxis2) and the \\ref legend. They make it very easy working with plots that only have a single\n  axis rect and at most one axis at each axis rect side. If you use \\link thelayoutsystem the\n  layout system\\endlink to add multiple axis rects or multiple axes to one side, use the \\ref\n  QCPAxisRect::axis interface to access the new axes. If one of the four default axes or the\n  default legend is removed due to manipulation of the layout system (e.g. by removing the main\n  axis rect), the corresponding pointers become 0.\n*/\n\n/*! \\var QCPAxis *QCustomPlot::xAxis2\n\n  A pointer to the secondary x Axis (top) of the main axis rect of the plot. Secondary axes are\n  invisible by default. Use QCPAxis::setVisible to change this (or use \\ref\n  QCPAxisRect::setupFullAxesBox).\n  \n  QCustomPlot offers convenient pointers to the axes (\\ref xAxis, \\ref yAxis, \\ref xAxis2, \\ref\n  yAxis2) and the \\ref legend. They make it very easy working with plots that only have a single\n  axis rect and at most one axis at each axis rect side. If you use \\link thelayoutsystem the\n  layout system\\endlink to add multiple axis rects or multiple axes to one side, use the \\ref\n  QCPAxisRect::axis interface to access the new axes. If one of the four default axes or the\n  default legend is removed due to manipulation of the layout system (e.g. by removing the main\n  axis rect), the corresponding pointers become 0.\n*/\n\n/*! \\var QCPAxis *QCustomPlot::yAxis2\n\n  A pointer to the secondary y Axis (right) of the main axis rect of the plot. Secondary axes are\n  invisible by default. Use QCPAxis::setVisible to change this (or use \\ref\n  QCPAxisRect::setupFullAxesBox).\n  \n  QCustomPlot offers convenient pointers to the axes (\\ref xAxis, \\ref yAxis, \\ref xAxis2, \\ref\n  yAxis2) and the \\ref legend. They make it very easy working with plots that only have a single\n  axis rect and at most one axis at each axis rect side. If you use \\link thelayoutsystem the\n  layout system\\endlink to add multiple axis rects or multiple axes to one side, use the \\ref\n  QCPAxisRect::axis interface to access the new axes. If one of the four default axes or the\n  default legend is removed due to manipulation of the layout system (e.g. by removing the main\n  axis rect), the corresponding pointers become 0.\n*/\n\n/*! \\var QCPLegend *QCustomPlot::legend\n\n  A pointer to the default legend of the main axis rect. The legend is invisible by default. Use\n  QCPLegend::setVisible to change this.\n  \n  QCustomPlot offers convenient pointers to the axes (\\ref xAxis, \\ref yAxis, \\ref xAxis2, \\ref\n  yAxis2) and the \\ref legend. They make it very easy working with plots that only have a single\n  axis rect and at most one axis at each axis rect side. If you use \\link thelayoutsystem the\n  layout system\\endlink to add multiple legends to the plot, use the layout system interface to\n  access the new legend. For example, legends can be placed inside an axis rect's \\ref\n  QCPAxisRect::insetLayout \"inset layout\", and must then also be accessed via the inset layout. If\n  the default legend is removed due to manipulation of the layout system (e.g. by removing the main\n  axis rect), the corresponding pointer becomes 0.\n*/\n\n/* end of documentation of public members */\n\n/*!\n  Constructs a QCustomPlot and sets reasonable default values.\n*/\nQCustomPlot::QCustomPlot(QWidget *parent) :\n  QWidget(parent),\n  xAxis(0),\n  yAxis(0),\n  xAxis2(0),\n  yAxis2(0),\n  legend(0),\n  mPlotLayout(0),\n  mAutoAddPlottableToLegend(true),\n  mAntialiasedElements(QCP::aeNone),\n  mNotAntialiasedElements(QCP::aeNone),\n  mInteractions(0),\n  mSelectionTolerance(8),\n  mNoAntialiasingOnDrag(false),\n  mBackgroundBrush(Qt::white, Qt::SolidPattern),\n  mBackgroundScaled(true),\n  mBackgroundScaledMode(Qt::KeepAspectRatioByExpanding),\n  mCurrentLayer(0),\n  mPlottingHints(QCP::phCacheLabels|QCP::phForceRepaint),\n  mMultiSelectModifier(Qt::ControlModifier),\n  mPaintBuffer(size()),\n  mMouseEventElement(0),\n  mReplotting(false)\n{\n  setAttribute(Qt::WA_NoMousePropagation);\n  setAttribute(Qt::WA_OpaquePaintEvent);\n  setMouseTracking(true);\n  QLocale currentLocale = locale();\n  currentLocale.setNumberOptions(QLocale::OmitGroupSeparator);\n  setLocale(currentLocale);\n  \n  // create initial layers:\n  mLayers.append(new QCPLayer(this, \"background\"));\n  mLayers.append(new QCPLayer(this, \"grid\"));\n  mLayers.append(new QCPLayer(this, \"main\"));\n  mLayers.append(new QCPLayer(this, \"axes\"));\n  mLayers.append(new QCPLayer(this, \"legend\"));\n  updateLayerIndices();\n  setCurrentLayer(\"main\");\n  \n  // create initial layout, axis rect and legend:\n  mPlotLayout = new QCPLayoutGrid;\n  mPlotLayout->initializeParentPlot(this);\n  mPlotLayout->setParent(this); // important because if parent is QWidget, QCPLayout::sizeConstraintsChanged will call QWidget::updateGeometry\n  mPlotLayout->setLayer(\"main\");\n  QCPAxisRect *defaultAxisRect = new QCPAxisRect(this, true);\n  mPlotLayout->addElement(0, 0, defaultAxisRect);\n  xAxis = defaultAxisRect->axis(QCPAxis::atBottom);\n  yAxis = defaultAxisRect->axis(QCPAxis::atLeft);\n  xAxis2 = defaultAxisRect->axis(QCPAxis::atTop);\n  yAxis2 = defaultAxisRect->axis(QCPAxis::atRight);\n  legend = new QCPLegend;\n  legend->setVisible(false);\n  defaultAxisRect->insetLayout()->addElement(legend, Qt::AlignRight|Qt::AlignTop);\n  defaultAxisRect->insetLayout()->setMargins(QMargins(12, 12, 12, 12));\n  \n  defaultAxisRect->setLayer(\"background\");\n  xAxis->setLayer(\"axes\");\n  yAxis->setLayer(\"axes\");\n  xAxis2->setLayer(\"axes\");\n  yAxis2->setLayer(\"axes\");\n  xAxis->grid()->setLayer(\"grid\");\n  yAxis->grid()->setLayer(\"grid\");\n  xAxis2->grid()->setLayer(\"grid\");\n  yAxis2->grid()->setLayer(\"grid\");\n  legend->setLayer(\"legend\");\n  \n  setViewport(rect()); // needs to be called after mPlotLayout has been created\n  \n  replot();\n}\n\nQCustomPlot::~QCustomPlot()\n{\n  clearPlottables();\n  clearItems();\n\n  if (mPlotLayout)\n  {\n    delete mPlotLayout;\n    mPlotLayout = 0;\n  }\n  \n  mCurrentLayer = 0;\n  qDeleteAll(mLayers); // don't use removeLayer, because it would prevent the last layer to be removed\n  mLayers.clear();\n}\n\n/*!\n  Sets which elements are forcibly drawn antialiased as an \\a or combination of QCP::AntialiasedElement.\n  \n  This overrides the antialiasing settings for whole element groups, normally controlled with the\n  \\a setAntialiasing function on the individual elements. If an element is neither specified in\n  \\ref setAntialiasedElements nor in \\ref setNotAntialiasedElements, the antialiasing setting on\n  each individual element instance is used.\n  \n  For example, if \\a antialiasedElements contains \\ref QCP::aePlottables, all plottables will be\n  drawn antialiased, no matter what the specific QCPAbstractPlottable::setAntialiased value was set\n  to.\n  \n  if an element in \\a antialiasedElements is already set in \\ref setNotAntialiasedElements, it is\n  removed from there.\n  \n  \\see setNotAntialiasedElements\n*/\nvoid QCustomPlot::setAntialiasedElements(const QCP::AntialiasedElements &antialiasedElements)\n{\n  mAntialiasedElements = antialiasedElements;\n  \n  // make sure elements aren't in mNotAntialiasedElements and mAntialiasedElements simultaneously:\n  if ((mNotAntialiasedElements & mAntialiasedElements) != 0)\n    mNotAntialiasedElements |= ~mAntialiasedElements;\n}\n\n/*!\n  Sets whether the specified \\a antialiasedElement is forcibly drawn antialiased.\n  \n  See \\ref setAntialiasedElements for details.\n  \n  \\see setNotAntialiasedElement\n*/\nvoid QCustomPlot::setAntialiasedElement(QCP::AntialiasedElement antialiasedElement, bool enabled)\n{\n  if (!enabled && mAntialiasedElements.testFlag(antialiasedElement))\n    mAntialiasedElements &= ~antialiasedElement;\n  else if (enabled && !mAntialiasedElements.testFlag(antialiasedElement))\n    mAntialiasedElements |= antialiasedElement;\n  \n  // make sure elements aren't in mNotAntialiasedElements and mAntialiasedElements simultaneously:\n  if ((mNotAntialiasedElements & mAntialiasedElements) != 0)\n    mNotAntialiasedElements |= ~mAntialiasedElements;\n}\n\n/*!\n  Sets which elements are forcibly drawn not antialiased as an \\a or combination of\n  QCP::AntialiasedElement.\n  \n  This overrides the antialiasing settings for whole element groups, normally controlled with the\n  \\a setAntialiasing function on the individual elements. If an element is neither specified in\n  \\ref setAntialiasedElements nor in \\ref setNotAntialiasedElements, the antialiasing setting on\n  each individual element instance is used.\n  \n  For example, if \\a notAntialiasedElements contains \\ref QCP::aePlottables, no plottables will be\n  drawn antialiased, no matter what the specific QCPAbstractPlottable::setAntialiased value was set\n  to.\n  \n  if an element in \\a notAntialiasedElements is already set in \\ref setAntialiasedElements, it is\n  removed from there.\n  \n  \\see setAntialiasedElements\n*/\nvoid QCustomPlot::setNotAntialiasedElements(const QCP::AntialiasedElements &notAntialiasedElements)\n{\n  mNotAntialiasedElements = notAntialiasedElements;\n  \n  // make sure elements aren't in mNotAntialiasedElements and mAntialiasedElements simultaneously:\n  if ((mNotAntialiasedElements & mAntialiasedElements) != 0)\n    mAntialiasedElements |= ~mNotAntialiasedElements;\n}\n\n/*!\n  Sets whether the specified \\a notAntialiasedElement is forcibly drawn not antialiased.\n  \n  See \\ref setNotAntialiasedElements for details.\n  \n  \\see setAntialiasedElement\n*/\nvoid QCustomPlot::setNotAntialiasedElement(QCP::AntialiasedElement notAntialiasedElement, bool enabled)\n{\n  if (!enabled && mNotAntialiasedElements.testFlag(notAntialiasedElement))\n    mNotAntialiasedElements &= ~notAntialiasedElement;\n  else if (enabled && !mNotAntialiasedElements.testFlag(notAntialiasedElement))\n    mNotAntialiasedElements |= notAntialiasedElement;\n  \n  // make sure elements aren't in mNotAntialiasedElements and mAntialiasedElements simultaneously:\n  if ((mNotAntialiasedElements & mAntialiasedElements) != 0)\n    mAntialiasedElements |= ~mNotAntialiasedElements;\n}\n\n/*!\n  If set to true, adding a plottable (e.g. a graph) to the QCustomPlot automatically also adds the\n  plottable to the legend (QCustomPlot::legend).\n  \n  \\see addPlottable, addGraph, QCPLegend::addItem\n*/\nvoid QCustomPlot::setAutoAddPlottableToLegend(bool on)\n{\n  mAutoAddPlottableToLegend = on;\n}\n\n/*!\n  Sets the possible interactions of this QCustomPlot as an or-combination of \\ref QCP::Interaction\n  enums. There are the following types of interactions:\n  \n  <b>Axis range manipulation</b> is controlled via \\ref QCP::iRangeDrag and \\ref QCP::iRangeZoom. When the\n  respective interaction is enabled, the user may drag axes ranges and zoom with the mouse wheel.\n  For details how to control which axes the user may drag/zoom and in what orientations, see \\ref\n  QCPAxisRect::setRangeDrag, \\ref QCPAxisRect::setRangeZoom, \\ref QCPAxisRect::setRangeDragAxes,\n  \\ref QCPAxisRect::setRangeZoomAxes.\n  \n  <b>Plottable selection</b> is controlled by \\ref QCP::iSelectPlottables. If \\ref QCP::iSelectPlottables is\n  set, the user may select plottables (graphs, curves, bars,...) by clicking on them or in their\n  vicinity (\\ref setSelectionTolerance). Whether the user can actually select a plottable can\n  further be restricted with the \\ref QCPAbstractPlottable::setSelectable function on the specific\n  plottable. To find out whether a specific plottable is selected, call\n  QCPAbstractPlottable::selected(). To retrieve a list of all currently selected plottables, call\n  \\ref selectedPlottables. If you're only interested in QCPGraphs, you may use the convenience\n  function \\ref selectedGraphs.\n  \n  <b>Item selection</b> is controlled by \\ref QCP::iSelectItems. If \\ref QCP::iSelectItems is set, the user\n  may select items (QCPItemLine, QCPItemText,...) by clicking on them or in their vicinity. To find\n  out whether a specific item is selected, call QCPAbstractItem::selected(). To retrieve a list of\n  all currently selected items, call \\ref selectedItems.\n  \n  <b>Axis selection</b> is controlled with \\ref QCP::iSelectAxes. If \\ref QCP::iSelectAxes is set, the user\n  may select parts of the axes by clicking on them. What parts exactly (e.g. Axis base line, tick\n  labels, axis label) are selectable can be controlled via \\ref QCPAxis::setSelectableParts for\n  each axis. To retrieve a list of all axes that currently contain selected parts, call \\ref\n  selectedAxes. Which parts of an axis are selected, can be retrieved with QCPAxis::selectedParts().\n  \n  <b>Legend selection</b> is controlled with \\ref QCP::iSelectLegend. If this is set, the user may\n  select the legend itself or individual items by clicking on them. What parts exactly are\n  selectable can be controlled via \\ref QCPLegend::setSelectableParts. To find out whether the\n  legend or any of its child items are selected, check the value of QCPLegend::selectedParts. To\n  find out which child items are selected, call \\ref QCPLegend::selectedItems.\n  \n  <b>All other selectable elements</b> The selection of all other selectable objects (e.g.\n  QCPPlotTitle, or your own layerable subclasses) is controlled with \\ref QCP::iSelectOther. If set, the\n  user may select those objects by clicking on them. To find out which are currently selected, you\n  need to check their selected state explicitly.\n  \n  If the selection state has changed by user interaction, the \\ref selectionChangedByUser signal is\n  emitted. Each selectable object additionally emits an individual selectionChanged signal whenever\n  their selection state has changed, i.e. not only by user interaction.\n  \n  To allow multiple objects to be selected by holding the selection modifier (\\ref\n  setMultiSelectModifier), set the flag \\ref QCP::iMultiSelect.\n  \n  \\note In addition to the selection mechanism presented here, QCustomPlot always emits\n  corresponding signals, when an object is clicked or double clicked. see \\ref plottableClick and\n  \\ref plottableDoubleClick for example.\n  \n  \\see setInteraction, setSelectionTolerance\n*/\nvoid QCustomPlot::setInteractions(const QCP::Interactions &interactions)\n{\n  mInteractions = interactions;\n}\n\n/*!\n  Sets the single \\a interaction of this QCustomPlot to \\a enabled.\n  \n  For details about the interaction system, see \\ref setInteractions.\n  \n  \\see setInteractions\n*/\nvoid QCustomPlot::setInteraction(const QCP::Interaction &interaction, bool enabled)\n{\n  if (!enabled && mInteractions.testFlag(interaction))\n    mInteractions &= ~interaction;\n  else if (enabled && !mInteractions.testFlag(interaction))\n    mInteractions |= interaction;\n}\n\n/*!\n  Sets the tolerance that is used to decide whether a click selects an object (e.g. a plottable) or\n  not.\n  \n  If the user clicks in the vicinity of the line of e.g. a QCPGraph, it's only regarded as a\n  potential selection when the minimum distance between the click position and the graph line is\n  smaller than \\a pixels. Objects that are defined by an area (e.g. QCPBars) only react to clicks\n  directly inside the area and ignore this selection tolerance. In other words, it only has meaning\n  for parts of objects that are too thin to exactly hit with a click and thus need such a\n  tolerance.\n  \n  \\see setInteractions, QCPLayerable::selectTest\n*/\nvoid QCustomPlot::setSelectionTolerance(int pixels)\n{\n  mSelectionTolerance = pixels;\n}\n\n/*!\n  Sets whether antialiasing is disabled for this QCustomPlot while the user is dragging axes\n  ranges. If many objects, especially plottables, are drawn antialiased, this greatly improves\n  performance during dragging. Thus it creates a more responsive user experience. As soon as the\n  user stops dragging, the last replot is done with normal antialiasing, to restore high image\n  quality.\n  \n  \\see setAntialiasedElements, setNotAntialiasedElements\n*/\nvoid QCustomPlot::setNoAntialiasingOnDrag(bool enabled)\n{\n  mNoAntialiasingOnDrag = enabled;\n}\n\n/*!\n  Sets the plotting hints for this QCustomPlot instance as an \\a or combination of QCP::PlottingHint.\n  \n  \\see setPlottingHint\n*/\nvoid QCustomPlot::setPlottingHints(const QCP::PlottingHints &hints)\n{\n  mPlottingHints = hints;\n}\n\n/*!\n  Sets the specified plotting \\a hint to \\a enabled.\n  \n  \\see setPlottingHints\n*/\nvoid QCustomPlot::setPlottingHint(QCP::PlottingHint hint, bool enabled)\n{\n  QCP::PlottingHints newHints = mPlottingHints;\n  if (!enabled)\n    newHints &= ~hint;\n  else\n    newHints |= hint;\n  \n  if (newHints != mPlottingHints)\n    setPlottingHints(newHints);\n}\n\n/*!\n  Sets the keyboard modifier that will be recognized as multi-select-modifier.\n  \n  If \\ref QCP::iMultiSelect is specified in \\ref setInteractions, the user may select multiple objects\n  by clicking on them one after the other while holding down \\a modifier.\n  \n  By default the multi-select-modifier is set to Qt::ControlModifier.\n  \n  \\see setInteractions\n*/\nvoid QCustomPlot::setMultiSelectModifier(Qt::KeyboardModifier modifier)\n{\n  mMultiSelectModifier = modifier;\n}\n\n/*!\n  Sets the viewport of this QCustomPlot. The Viewport is the area that the top level layout\n  (QCustomPlot::plotLayout()) uses as its rect. Normally, the viewport is the entire widget rect.\n  \n  This function is used to allow arbitrary size exports with \\ref toPixmap, \\ref savePng, \\ref\n  savePdf, etc. by temporarily changing the viewport size.\n*/\nvoid QCustomPlot::setViewport(const QRect &rect)\n{\n  mViewport = rect;\n  if (mPlotLayout)\n    mPlotLayout->setOuterRect(mViewport);\n}\n\n/*!\n  Sets \\a pm as the viewport background pixmap (see \\ref setViewport). The pixmap is always drawn\n  below all other objects in the plot.\n\n  For cases where the provided pixmap doesn't have the same size as the viewport, scaling can be\n  enabled with \\ref setBackgroundScaled and the scaling mode (whether and how the aspect ratio is\n  preserved) can be set with \\ref setBackgroundScaledMode. To set all these options in one call,\n  consider using the overloaded version of this function.\n  \n  If a background brush was set with \\ref setBackground(const QBrush &brush), the viewport will\n  first be filled with that brush, before drawing the background pixmap. This can be useful for\n  background pixmaps with translucent areas.\n\n  \\see setBackgroundScaled, setBackgroundScaledMode\n*/\nvoid QCustomPlot::setBackground(const QPixmap &pm)\n{\n  mBackgroundPixmap = pm;\n  mScaledBackgroundPixmap = QPixmap();\n}\n\n/*!\n  Sets the background brush of the viewport (see \\ref setViewport).\n\n  Before drawing everything else, the background is filled with \\a brush. If a background pixmap\n  was set with \\ref setBackground(const QPixmap &pm), this brush will be used to fill the viewport\n  before the background pixmap is drawn. This can be useful for background pixmaps with translucent\n  areas.\n  \n  Set \\a brush to Qt::NoBrush or Qt::Transparent to leave background transparent. This can be\n  useful for exporting to image formats which support transparency, e.g. \\ref savePng.\n\n  \\see setBackgroundScaled, setBackgroundScaledMode\n*/\nvoid QCustomPlot::setBackground(const QBrush &brush)\n{\n  mBackgroundBrush = brush;\n}\n\n/*! \\overload\n  \n  Allows setting the background pixmap of the viewport, whether it shall be scaled and how it\n  shall be scaled in one call.\n\n  \\see setBackground(const QPixmap &pm), setBackgroundScaled, setBackgroundScaledMode\n*/\nvoid QCustomPlot::setBackground(const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode)\n{\n  mBackgroundPixmap = pm;\n  mScaledBackgroundPixmap = QPixmap();\n  mBackgroundScaled = scaled;\n  mBackgroundScaledMode = mode;\n}\n\n/*!\n  Sets whether the viewport background pixmap shall be scaled to fit the viewport. If \\a scaled is\n  set to true, control whether and how the aspect ratio of the original pixmap is preserved with\n  \\ref setBackgroundScaledMode.\n  \n  Note that the scaled version of the original pixmap is buffered, so there is no performance\n  penalty on replots. (Except when the viewport dimensions are changed continuously.)\n  \n  \\see setBackground, setBackgroundScaledMode\n*/\nvoid QCustomPlot::setBackgroundScaled(bool scaled)\n{\n  mBackgroundScaled = scaled;\n}\n\n/*!\n  If scaling of the viewport background pixmap is enabled (\\ref setBackgroundScaled), use this\n  function to define whether and how the aspect ratio of the original pixmap is preserved.\n  \n  \\see setBackground, setBackgroundScaled\n*/\nvoid QCustomPlot::setBackgroundScaledMode(Qt::AspectRatioMode mode)\n{\n  mBackgroundScaledMode = mode;\n}\n\n/*!\n  Returns the plottable with \\a index. If the index is invalid, returns 0.\n  \n  There is an overloaded version of this function with no parameter which returns the last added\n  plottable, see QCustomPlot::plottable()\n  \n  \\see plottableCount, addPlottable\n*/\nQCPAbstractPlottable *QCustomPlot::plottable(int index)\n{\n  if (index >= 0 && index < mPlottables.size())\n  {\n    return mPlottables.at(index);\n  } else\n  {\n    qDebug() << Q_FUNC_INFO << \"index out of bounds:\" << index;\n    return 0;\n  }\n}\n\n/*! \\overload\n  \n  Returns the last plottable that was added with \\ref addPlottable. If there are no plottables in\n  the plot, returns 0.\n  \n  \\see plottableCount, addPlottable\n*/\nQCPAbstractPlottable *QCustomPlot::plottable()\n{\n  if (!mPlottables.isEmpty())\n  {\n    return mPlottables.last();\n  } else\n    return 0;\n}\n\n/*!\n  Adds the specified plottable to the plot and, if \\ref setAutoAddPlottableToLegend is enabled, to\n  the legend (QCustomPlot::legend). QCustomPlot takes ownership of the plottable.\n  \n  Returns true on success, i.e. when \\a plottable isn't already in the plot and the parent plot of\n  \\a plottable is this QCustomPlot (the latter is controlled by what axes were passed in the\n  plottable's constructor).\n  \n  \\see plottable, plottableCount, removePlottable, clearPlottables\n*/\nbool QCustomPlot::addPlottable(QCPAbstractPlottable *plottable)\n{\n  if (mPlottables.contains(plottable))\n  {\n    qDebug() << Q_FUNC_INFO << \"plottable already added to this QCustomPlot:\" << reinterpret_cast<quintptr>(plottable);\n    return false;\n  }\n  if (plottable->parentPlot() != this)\n  {\n    qDebug() << Q_FUNC_INFO << \"plottable not created with this QCustomPlot as parent:\" << reinterpret_cast<quintptr>(plottable);\n    return false;\n  }\n  \n  mPlottables.append(plottable);\n  // possibly add plottable to legend:\n  if (mAutoAddPlottableToLegend)\n    plottable->addToLegend();\n  // special handling for QCPGraphs to maintain the simple graph interface:\n  if (QCPGraph *graph = qobject_cast<QCPGraph*>(plottable))\n    mGraphs.append(graph);\n  if (!plottable->layer()) // usually the layer is already set in the constructor of the plottable (via QCPLayerable constructor)\n    plottable->setLayer(currentLayer());\n  return true;\n}\n\n/*!\n  Removes the specified plottable from the plot and, if necessary, from the legend (QCustomPlot::legend).\n  \n  Returns true on success.\n  \n  \\see addPlottable, clearPlottables\n*/\nbool QCustomPlot::removePlottable(QCPAbstractPlottable *plottable)\n{\n  if (!mPlottables.contains(plottable))\n  {\n    qDebug() << Q_FUNC_INFO << \"plottable not in list:\" << reinterpret_cast<quintptr>(plottable);\n    return false;\n  }\n  \n  // remove plottable from legend:\n  plottable->removeFromLegend();\n  // special handling for QCPGraphs to maintain the simple graph interface:\n  if (QCPGraph *graph = qobject_cast<QCPGraph*>(plottable))\n    mGraphs.removeOne(graph);\n  // remove plottable:\n  delete plottable;\n  mPlottables.removeOne(plottable);\n  return true;\n}\n\n/*! \\overload\n  \n  Removes the plottable by its \\a index.\n*/\nbool QCustomPlot::removePlottable(int index)\n{\n  if (index >= 0 && index < mPlottables.size())\n    return removePlottable(mPlottables[index]);\n  else\n  {\n    qDebug() << Q_FUNC_INFO << \"index out of bounds:\" << index;\n    return false;\n  }\n}\n\n/*!\n  Removes all plottables from the plot (and the QCustomPlot::legend, if necessary).\n  \n  Returns the number of plottables removed.\n  \n  \\see removePlottable\n*/\nint QCustomPlot::clearPlottables()\n{\n  int c = mPlottables.size();\n  for (int i=c-1; i >= 0; --i)\n    removePlottable(mPlottables[i]);\n  return c;\n}\n\n/*!\n  Returns the number of currently existing plottables in the plot\n  \n  \\see plottable, addPlottable\n*/\nint QCustomPlot::plottableCount() const\n{\n  return mPlottables.size();\n}\n\n/*!\n  Returns a list of the selected plottables. If no plottables are currently selected, the list is empty.\n  \n  There is a convenience function if you're only interested in selected graphs, see \\ref selectedGraphs.\n  \n  \\see setInteractions, QCPAbstractPlottable::setSelectable, QCPAbstractPlottable::setSelected\n*/\nQList<QCPAbstractPlottable*> QCustomPlot::selectedPlottables() const\n{\n  QList<QCPAbstractPlottable*> result;\n  foreach (QCPAbstractPlottable *plottable, mPlottables)\n  {\n    if (plottable->selected())\n      result.append(plottable);\n  }\n  return result;\n}\n\n/*!\n  Returns the plottable at the pixel position \\a pos. Plottables that only consist of single lines\n  (like graphs) have a tolerance band around them, see \\ref setSelectionTolerance. If multiple\n  plottables come into consideration, the one closest to \\a pos is returned.\n  \n  If \\a onlySelectable is true, only plottables that are selectable\n  (QCPAbstractPlottable::setSelectable) are considered.\n  \n  If there is no plottable at \\a pos, the return value is 0.\n  \n  \\see itemAt, layoutElementAt\n*/\nQCPAbstractPlottable *QCustomPlot::plottableAt(const QPointF &pos, bool onlySelectable) const\n{\n  QCPAbstractPlottable *resultPlottable = 0;\n  double resultDistance = mSelectionTolerance; // only regard clicks with distances smaller than mSelectionTolerance as selections, so initialize with that value\n  \n  foreach (QCPAbstractPlottable *plottable, mPlottables)\n  {\n    if (onlySelectable && !plottable->selectable()) // we could have also passed onlySelectable to the selectTest function, but checking here is faster, because we have access to QCPabstractPlottable::selectable\n      continue;\n    if ((plottable->keyAxis()->axisRect()->rect() & plottable->valueAxis()->axisRect()->rect()).contains(pos.toPoint())) // only consider clicks inside the rect that is spanned by the plottable's key/value axes\n    {\n      double currentDistance = plottable->selectTest(pos, false);\n      if (currentDistance >= 0 && currentDistance < resultDistance)\n      {\n        resultPlottable = plottable;\n        resultDistance = currentDistance;\n      }\n    }\n  }\n  \n  return resultPlottable;\n}\n\n/*!\n  Returns whether this QCustomPlot instance contains the \\a plottable.\n  \n  \\see addPlottable\n*/\nbool QCustomPlot::hasPlottable(QCPAbstractPlottable *plottable) const\n{\n  return mPlottables.contains(plottable);\n}\n\n/*!\n  Returns the graph with \\a index. If the index is invalid, returns 0.\n  \n  There is an overloaded version of this function with no parameter which returns the last created\n  graph, see QCustomPlot::graph()\n  \n  \\see graphCount, addGraph\n*/\nQCPGraph *QCustomPlot::graph(int index) const\n{\n  if (index >= 0 && index < mGraphs.size())\n  {\n    return mGraphs.at(index);\n  } else\n  {\n    qDebug() << Q_FUNC_INFO << \"index out of bounds:\" << index;\n    return 0;\n  }\n}\n\n/*! \\overload\n  \n  Returns the last graph, that was created with \\ref addGraph. If there are no graphs in the plot,\n  returns 0.\n  \n  \\see graphCount, addGraph\n*/\nQCPGraph *QCustomPlot::graph() const\n{\n  if (!mGraphs.isEmpty())\n  {\n    return mGraphs.last();\n  } else\n    return 0;\n}\n\n/*!\n  Creates a new graph inside the plot. If \\a keyAxis and \\a valueAxis are left unspecified (0), the\n  bottom (xAxis) is used as key and the left (yAxis) is used as value axis. If specified, \\a\n  keyAxis and \\a valueAxis must reside in this QCustomPlot.\n  \n  \\a keyAxis will be used as key axis (typically \"x\") and \\a valueAxis as value axis (typically\n  \"y\") for the graph.\n  \n  Returns a pointer to the newly created graph, or 0 if adding the graph failed.\n  \n  \\see graph, graphCount, removeGraph, clearGraphs\n*/\nQCPGraph *QCustomPlot::addGraph(QCPAxis *keyAxis, QCPAxis *valueAxis)\n{\n  if (!keyAxis) keyAxis = xAxis;\n  if (!valueAxis) valueAxis = yAxis;\n  if (!keyAxis || !valueAxis)\n  {\n    qDebug() << Q_FUNC_INFO << \"can't use default QCustomPlot xAxis or yAxis, because at least one is invalid (has been deleted)\";\n    return 0;\n  }\n  if (keyAxis->parentPlot() != this || valueAxis->parentPlot() != this)\n  {\n    qDebug() << Q_FUNC_INFO << \"passed keyAxis or valueAxis doesn't have this QCustomPlot as parent\";\n    return 0;\n  }\n  \n  QCPGraph *newGraph = new QCPGraph(keyAxis, valueAxis);\n  if (addPlottable(newGraph))\n  {\n    newGraph->setName(\"Graph \"+QString::number(mGraphs.size()));\n    return newGraph;\n  } else\n  {\n    delete newGraph;\n    return 0;\n  }\n}\n\n/*!\n  Removes the specified \\a graph from the plot and, if necessary, from the QCustomPlot::legend. If\n  any other graphs in the plot have a channel fill set towards the removed graph, the channel fill\n  property of those graphs is reset to zero (no channel fill).\n  \n  Returns true on success.\n  \n  \\see clearGraphs\n*/\nbool QCustomPlot::removeGraph(QCPGraph *graph)\n{\n  return removePlottable(graph);\n}\n\n/*! \\overload\n  \n  Removes the graph by its \\a index.\n*/\nbool QCustomPlot::removeGraph(int index)\n{\n  if (index >= 0 && index < mGraphs.size())\n    return removeGraph(mGraphs[index]);\n  else\n    return false;\n}\n\n/*!\n  Removes all graphs from the plot (and the QCustomPlot::legend, if necessary).\n\n  Returns the number of graphs removed.\n  \n  \\see removeGraph\n*/\nint QCustomPlot::clearGraphs()\n{\n  int c = mGraphs.size();\n  for (int i=c-1; i >= 0; --i)\n    removeGraph(mGraphs[i]);\n  return c;\n}\n\n/*!\n  Returns the number of currently existing graphs in the plot\n  \n  \\see graph, addGraph\n*/\nint QCustomPlot::graphCount() const\n{\n  return mGraphs.size();\n}\n\n/*!\n  Returns a list of the selected graphs. If no graphs are currently selected, the list is empty.\n  \n  If you are not only interested in selected graphs but other plottables like QCPCurve, QCPBars,\n  etc., use \\ref selectedPlottables.\n  \n  \\see setInteractions, selectedPlottables, QCPAbstractPlottable::setSelectable, QCPAbstractPlottable::setSelected\n*/\nQList<QCPGraph*> QCustomPlot::selectedGraphs() const\n{\n  QList<QCPGraph*> result;\n  foreach (QCPGraph *graph, mGraphs)\n  {\n    if (graph->selected())\n      result.append(graph);\n  }\n  return result;\n}\n\n/*!\n  Returns the item with \\a index. If the index is invalid, returns 0.\n  \n  There is an overloaded version of this function with no parameter which returns the last added\n  item, see QCustomPlot::item()\n  \n  \\see itemCount, addItem\n*/\nQCPAbstractItem *QCustomPlot::item(int index) const\n{\n  if (index >= 0 && index < mItems.size())\n  {\n    return mItems.at(index);\n  } else\n  {\n    qDebug() << Q_FUNC_INFO << \"index out of bounds:\" << index;\n    return 0;\n  }\n}\n\n/*! \\overload\n  \n  Returns the last item, that was added with \\ref addItem. If there are no items in the plot,\n  returns 0.\n  \n  \\see itemCount, addItem\n*/\nQCPAbstractItem *QCustomPlot::item() const\n{\n  if (!mItems.isEmpty())\n  {\n    return mItems.last();\n  } else\n    return 0;\n}\n\n/*!\n  Adds the specified item to the plot. QCustomPlot takes ownership of the item.\n  \n  Returns true on success, i.e. when \\a item wasn't already in the plot and the parent plot of \\a\n  item is this QCustomPlot.\n  \n  \\see item, itemCount, removeItem, clearItems\n*/\nbool QCustomPlot::addItem(QCPAbstractItem *item)\n{\n  if (!mItems.contains(item) && item->parentPlot() == this)\n  {\n    mItems.append(item);\n    return true;\n  } else\n  {\n    qDebug() << Q_FUNC_INFO << \"item either already in list or not created with this QCustomPlot as parent:\" << reinterpret_cast<quintptr>(item);\n    return false;\n  }\n}\n\n/*!\n  Removes the specified item from the plot.\n  \n  Returns true on success.\n  \n  \\see addItem, clearItems\n*/\nbool QCustomPlot::removeItem(QCPAbstractItem *item)\n{\n  if (mItems.contains(item))\n  {\n    delete item;\n    mItems.removeOne(item);\n    return true;\n  } else\n  {\n    qDebug() << Q_FUNC_INFO << \"item not in list:\" << reinterpret_cast<quintptr>(item);\n    return false;\n  }\n}\n\n/*! \\overload\n  \n  Removes the item by its \\a index.\n*/\nbool QCustomPlot::removeItem(int index)\n{\n  if (index >= 0 && index < mItems.size())\n    return removeItem(mItems[index]);\n  else\n  {\n    qDebug() << Q_FUNC_INFO << \"index out of bounds:\" << index;\n    return false;\n  }\n}\n\n/*!\n  Removes all items from the plot.\n  \n  Returns the number of items removed.\n  \n  \\see removeItem\n*/\nint QCustomPlot::clearItems()\n{\n  int c = mItems.size();\n  for (int i=c-1; i >= 0; --i)\n    removeItem(mItems[i]);\n  return c;\n}\n\n/*!\n  Returns the number of currently existing items in the plot\n  \n  \\see item, addItem\n*/\nint QCustomPlot::itemCount() const\n{\n  return mItems.size();\n}\n\n/*!\n  Returns a list of the selected items. If no items are currently selected, the list is empty.\n  \n  \\see setInteractions, QCPAbstractItem::setSelectable, QCPAbstractItem::setSelected\n*/\nQList<QCPAbstractItem*> QCustomPlot::selectedItems() const\n{\n  QList<QCPAbstractItem*> result;\n  foreach (QCPAbstractItem *item, mItems)\n  {\n    if (item->selected())\n      result.append(item);\n  }\n  return result;\n}\n\n/*!\n  Returns the item at the pixel position \\a pos. Items that only consist of single lines (e.g. \\ref\n  QCPItemLine or \\ref QCPItemCurve) have a tolerance band around them, see \\ref\n  setSelectionTolerance. If multiple items come into consideration, the one closest to \\a pos is\n  returned.\n  \n  If \\a onlySelectable is true, only items that are selectable (QCPAbstractItem::setSelectable) are\n  considered.\n  \n  If there is no item at \\a pos, the return value is 0.\n  \n  \\see plottableAt, layoutElementAt\n*/\nQCPAbstractItem *QCustomPlot::itemAt(const QPointF &pos, bool onlySelectable) const\n{\n  QCPAbstractItem *resultItem = 0;\n  double resultDistance = mSelectionTolerance; // only regard clicks with distances smaller than mSelectionTolerance as selections, so initialize with that value\n  \n  foreach (QCPAbstractItem *item, mItems)\n  {\n    if (onlySelectable && !item->selectable()) // we could have also passed onlySelectable to the selectTest function, but checking here is faster, because we have access to QCPAbstractItem::selectable\n      continue;\n    if (!item->clipToAxisRect() || item->clipRect().contains(pos.toPoint())) // only consider clicks inside axis cliprect of the item if actually clipped to it\n    {\n      double currentDistance = item->selectTest(pos, false);\n      if (currentDistance >= 0 && currentDistance < resultDistance)\n      {\n        resultItem = item;\n        resultDistance = currentDistance;\n      }\n    }\n  }\n  \n  return resultItem;\n}\n\n/*!\n  Returns whether this QCustomPlot contains the \\a item.\n  \n  \\see addItem\n*/\nbool QCustomPlot::hasItem(QCPAbstractItem *item) const\n{\n  return mItems.contains(item);\n}\n\n/*!\n  Returns the layer with the specified \\a name. If there is no layer with the specified name, 0 is\n  returned.\n  \n  Layer names are case-sensitive.\n  \n  \\see addLayer, moveLayer, removeLayer\n*/\nQCPLayer *QCustomPlot::layer(const QString &name) const\n{\n  foreach (QCPLayer *layer, mLayers)\n  {\n    if (layer->name() == name)\n      return layer;\n  }\n  return 0;\n}\n\n/*! \\overload\n  \n  Returns the layer by \\a index. If the index is invalid, 0 is returned.\n  \n  \\see addLayer, moveLayer, removeLayer\n*/\nQCPLayer *QCustomPlot::layer(int index) const\n{\n  if (index >= 0 && index < mLayers.size())\n  {\n    return mLayers.at(index);\n  } else\n  {\n    qDebug() << Q_FUNC_INFO << \"index out of bounds:\" << index;\n    return 0;\n  }\n}\n\n/*!\n  Returns the layer that is set as current layer (see \\ref setCurrentLayer).\n*/\nQCPLayer *QCustomPlot::currentLayer() const\n{\n  return mCurrentLayer;\n}\n\n/*!\n  Sets the layer with the specified \\a name to be the current layer. All layerables (\\ref\n  QCPLayerable), e.g. plottables and items, are created on the current layer.\n  \n  Returns true on success, i.e. if there is a layer with the specified \\a name in the QCustomPlot.\n  \n  Layer names are case-sensitive.\n  \n  \\see addLayer, moveLayer, removeLayer, QCPLayerable::setLayer\n*/\nbool QCustomPlot::setCurrentLayer(const QString &name)\n{\n  if (QCPLayer *newCurrentLayer = layer(name))\n  {\n    return setCurrentLayer(newCurrentLayer);\n  } else\n  {\n    qDebug() << Q_FUNC_INFO << \"layer with name doesn't exist:\" << name;\n    return false;\n  }\n}\n\n/*! \\overload\n  \n  Sets the provided \\a layer to be the current layer.\n  \n  Returns true on success, i.e. when \\a layer is a valid layer in the QCustomPlot.\n  \n  \\see addLayer, moveLayer, removeLayer\n*/\nbool QCustomPlot::setCurrentLayer(QCPLayer *layer)\n{\n  if (!mLayers.contains(layer))\n  {\n    qDebug() << Q_FUNC_INFO << \"layer not a layer of this QCustomPlot:\" << reinterpret_cast<quintptr>(layer);\n    return false;\n  }\n  \n  mCurrentLayer = layer;\n  return true;\n}\n\n/*!\n  Returns the number of currently existing layers in the plot\n  \n  \\see layer, addLayer\n*/\nint QCustomPlot::layerCount() const\n{\n  return mLayers.size();\n}\n\n/*!\n  Adds a new layer to this QCustomPlot instance. The new layer will have the name \\a name, which\n  must be unique. Depending on \\a insertMode, it is positioned either below or above \\a otherLayer.\n  \n  Returns true on success, i.e. if there is no other layer named \\a name and \\a otherLayer is a\n  valid layer inside this QCustomPlot.\n  \n  If \\a otherLayer is 0, the highest layer in the QCustomPlot will be used.\n  \n  For an explanation of what layers are in QCustomPlot, see the documentation of \\ref QCPLayer.\n  \n  \\see layer, moveLayer, removeLayer\n*/\nbool QCustomPlot::addLayer(const QString &name, QCPLayer *otherLayer, QCustomPlot::LayerInsertMode insertMode)\n{\n  if (!otherLayer)\n    otherLayer = mLayers.last();\n  if (!mLayers.contains(otherLayer))\n  {\n    qDebug() << Q_FUNC_INFO << \"otherLayer not a layer of this QCustomPlot:\" << reinterpret_cast<quintptr>(otherLayer);\n    return false;\n  }\n  if (layer(name))\n  {\n    qDebug() << Q_FUNC_INFO << \"A layer exists already with the name\" << name;\n    return false;\n  }\n    \n  QCPLayer *newLayer = new QCPLayer(this, name);\n  mLayers.insert(otherLayer->index() + (insertMode==limAbove ? 1:0), newLayer);\n  updateLayerIndices();\n  return true;\n}\n\n/*!\n  Removes the specified \\a layer and returns true on success.\n  \n  All layerables (e.g. plottables and items) on the removed layer will be moved to the layer below\n  \\a layer. If \\a layer is the bottom layer, the layerables are moved to the layer above. In both\n  cases, the total rendering order of all layerables in the QCustomPlot is preserved.\n  \n  If \\a layer is the current layer (\\ref setCurrentLayer), the layer below (or above, if bottom\n  layer) becomes the new current layer.\n  \n  It is not possible to remove the last layer of the plot.\n  \n  \\see layer, addLayer, moveLayer\n*/\nbool QCustomPlot::removeLayer(QCPLayer *layer)\n{\n  if (!mLayers.contains(layer))\n  {\n    qDebug() << Q_FUNC_INFO << \"layer not a layer of this QCustomPlot:\" << reinterpret_cast<quintptr>(layer);\n    return false;\n  }\n  if (mLayers.size() < 2)\n  {\n    qDebug() << Q_FUNC_INFO << \"can't remove last layer\";\n    return false;\n  }\n  \n  // append all children of this layer to layer below (if this is lowest layer, prepend to layer above)\n  int removedIndex = layer->index();\n  bool isFirstLayer = removedIndex==0;\n  QCPLayer *targetLayer = isFirstLayer ? mLayers.at(removedIndex+1) : mLayers.at(removedIndex-1);\n  QList<QCPLayerable*> children = layer->children();\n  if (isFirstLayer) // prepend in reverse order (so order relative to each other stays the same)\n  {\n    for (int i=children.size()-1; i>=0; --i)\n      children.at(i)->moveToLayer(targetLayer, true);\n  } else  // append normally\n  {\n    for (int i=0; i<children.size(); ++i)\n      children.at(i)->moveToLayer(targetLayer, false);\n  }\n  // if removed layer is current layer, change current layer to layer below/above:\n  if (layer == mCurrentLayer)\n    setCurrentLayer(targetLayer);\n  // remove layer:\n  delete layer;\n  mLayers.removeOne(layer);\n  updateLayerIndices();\n  return true;\n}\n\n/*!\n  Moves the specified \\a layer either above or below \\a otherLayer. Whether it's placed above or\n  below is controlled with \\a insertMode.\n  \n  Returns true on success, i.e. when both \\a layer and \\a otherLayer are valid layers in the\n  QCustomPlot.\n  \n  \\see layer, addLayer, moveLayer\n*/\nbool QCustomPlot::moveLayer(QCPLayer *layer, QCPLayer *otherLayer, QCustomPlot::LayerInsertMode insertMode)\n{\n  if (!mLayers.contains(layer))\n  {\n    qDebug() << Q_FUNC_INFO << \"layer not a layer of this QCustomPlot:\" << reinterpret_cast<quintptr>(layer);\n    return false;\n  }\n  if (!mLayers.contains(otherLayer))\n  {\n    qDebug() << Q_FUNC_INFO << \"otherLayer not a layer of this QCustomPlot:\" << reinterpret_cast<quintptr>(otherLayer);\n    return false;\n  }\n  \n  mLayers.move(layer->index(), otherLayer->index() + (insertMode==limAbove ? 1:0));\n  updateLayerIndices();\n  return true;\n}\n\n/*!\n  Returns the number of axis rects in the plot.\n  \n  All axis rects can be accessed via QCustomPlot::axisRect().\n  \n  Initially, only one axis rect exists in the plot.\n  \n  \\see axisRect, axisRects\n*/\nint QCustomPlot::axisRectCount() const\n{\n  return axisRects().size();\n}\n\n/*!\n  Returns the axis rect with \\a index.\n  \n  Initially, only one axis rect (with index 0) exists in the plot. If multiple axis rects were\n  added, all of them may be accessed with this function in a linear fashion (even when they are\n  nested in a layout hierarchy or inside other axis rects via QCPAxisRect::insetLayout).\n  \n  \\see axisRectCount, axisRects\n*/\nQCPAxisRect *QCustomPlot::axisRect(int index) const\n{\n  const QList<QCPAxisRect*> rectList = axisRects();\n  if (index >= 0 && index < rectList.size())\n  {\n    return rectList.at(index);\n  } else\n  {\n    qDebug() << Q_FUNC_INFO << \"invalid axis rect index\" << index;\n    return 0;\n  }\n}\n\n/*!\n  Returns all axis rects in the plot.\n  \n  \\see axisRectCount, axisRect\n*/\nQList<QCPAxisRect*> QCustomPlot::axisRects() const\n{\n  QList<QCPAxisRect*> result;\n  QStack<QCPLayoutElement*> elementStack;\n  if (mPlotLayout)\n    elementStack.push(mPlotLayout);\n  \n  while (!elementStack.isEmpty())\n  {\n    foreach (QCPLayoutElement *element, elementStack.pop()->elements(false))\n    {\n      if (element)\n      {\n        elementStack.push(element);\n        if (QCPAxisRect *ar = qobject_cast<QCPAxisRect*>(element))\n          result.append(ar);\n      }\n    }\n  }\n  \n  return result;\n}\n\n/*!\n  Returns the layout element at pixel position \\a pos. If there is no element at that position,\n  returns 0.\n  \n  Only visible elements are used. If \\ref QCPLayoutElement::setVisible on the element itself or on\n  any of its parent elements is set to false, it will not be considered.\n  \n  \\see itemAt, plottableAt\n*/\nQCPLayoutElement *QCustomPlot::layoutElementAt(const QPointF &pos) const\n{\n  QCPLayoutElement *currentElement = mPlotLayout;\n  bool searchSubElements = true;\n  while (searchSubElements && currentElement)\n  {\n    searchSubElements = false;\n    foreach (QCPLayoutElement *subElement, currentElement->elements(false))\n    {\n      if (subElement && subElement->realVisibility() && subElement->selectTest(pos, false) >= 0)\n      {\n        currentElement = subElement;\n        searchSubElements = true;\n        break;\n      }\n    }\n  }\n  return currentElement;\n}\n\n/*!\n  Returns the axes that currently have selected parts, i.e. whose selection state is not \\ref\n  QCPAxis::spNone.\n  \n  \\see selectedPlottables, selectedLegends, setInteractions, QCPAxis::setSelectedParts,\n  QCPAxis::setSelectableParts\n*/\nQList<QCPAxis*> QCustomPlot::selectedAxes() const\n{\n  QList<QCPAxis*> result, allAxes;\n  foreach (QCPAxisRect *rect, axisRects())\n    allAxes << rect->axes();\n  \n  foreach (QCPAxis *axis, allAxes)\n  {\n    if (axis->selectedParts() != QCPAxis::spNone)\n      result.append(axis);\n  }\n  \n  return result;\n}\n\n/*!\n  Returns the legends that currently have selected parts, i.e. whose selection state is not \\ref\n  QCPLegend::spNone.\n  \n  \\see selectedPlottables, selectedAxes, setInteractions, QCPLegend::setSelectedParts,\n  QCPLegend::setSelectableParts, QCPLegend::selectedItems\n*/\nQList<QCPLegend*> QCustomPlot::selectedLegends() const\n{\n  QList<QCPLegend*> result;\n  \n  QStack<QCPLayoutElement*> elementStack;\n  if (mPlotLayout)\n    elementStack.push(mPlotLayout);\n  \n  while (!elementStack.isEmpty())\n  {\n    foreach (QCPLayoutElement *subElement, elementStack.pop()->elements(false))\n    {\n      if (subElement)\n      {\n        elementStack.push(subElement);\n        if (QCPLegend *leg = qobject_cast<QCPLegend*>(subElement))\n        {\n          if (leg->selectedParts() != QCPLegend::spNone)\n            result.append(leg);\n        }\n      }\n    }\n  }\n  \n  return result;\n}\n\n/*!\n  Deselects all layerables (plottables, items, axes, legends,...) of the QCustomPlot.\n  \n  Since calling this function is not a user interaction, this does not emit the \\ref\n  selectionChangedByUser signal. The individual selectionChanged signals are emitted though, if the\n  objects were previously selected.\n  \n  \\see setInteractions, selectedPlottables, selectedItems, selectedAxes, selectedLegends\n*/\nvoid QCustomPlot::deselectAll()\n{\n  foreach (QCPLayer *layer, mLayers)\n  {\n    foreach (QCPLayerable *layerable, layer->children())\n      layerable->deselectEvent(0);\n  }\n}\n\n/*!\n  Causes a complete replot into the internal buffer. Finally, update() is called, to redraw the\n  buffer on the QCustomPlot widget surface. This is the method that must be called to make changes,\n  for example on the axis ranges or data points of graphs, visible.\n  \n  Under a few circumstances, QCustomPlot causes a replot by itself. Those are resize events of the\n  QCustomPlot widget and user interactions (object selection and range dragging/zooming).\n  \n  Before the replot happens, the signal \\ref beforeReplot is emitted. After the replot, \\ref\n  afterReplot is emitted. It is safe to mutually connect the replot slot with any of those two\n  signals on two QCustomPlots to make them replot synchronously, it won't cause an infinite\n  recursion.\n*/\nvoid QCustomPlot::replot(QCustomPlot::RefreshPriority refreshPriority)\n{\n  if (mReplotting) // incase signals loop back to replot slot\n    return;\n  mReplotting = true;\n  emit beforeReplot();\n  \n  mPaintBuffer.fill(mBackgroundBrush.style() == Qt::SolidPattern ? mBackgroundBrush.color() : Qt::transparent);\n  QCPPainter painter;\n  painter.begin(&mPaintBuffer);\n  if (painter.isActive())\n  {\n    painter.setRenderHint(QPainter::HighQualityAntialiasing); // to make Antialiasing look good if using the OpenGL graphicssystem\n    if (mBackgroundBrush.style() != Qt::SolidPattern && mBackgroundBrush.style() != Qt::NoBrush)\n      painter.fillRect(mViewport, mBackgroundBrush);\n    draw(&painter);\n    painter.end();\n    if ((refreshPriority == rpHint && mPlottingHints.testFlag(QCP::phForceRepaint)) || refreshPriority==rpImmediate)\n      repaint();\n    else\n      update();\n  } else // might happen if QCustomPlot has width or height zero\n    qDebug() << Q_FUNC_INFO << \"Couldn't activate painter on buffer\";\n  \n  emit afterReplot();\n  mReplotting = false;\n}\n\n/*!\n  Rescales the axes such that all plottables (like graphs) in the plot are fully visible.\n  \n  if \\a onlyVisiblePlottables is set to true, only the plottables that have their visibility set to true\n  (QCPLayerable::setVisible), will be used to rescale the axes.\n  \n  \\see QCPAbstractPlottable::rescaleAxes, QCPAxis::rescale\n*/\nvoid QCustomPlot::rescaleAxes(bool onlyVisiblePlottables)\n{\n  QList<QCPAxis*> allAxes;\n  foreach (QCPAxisRect *rect, axisRects())\n    allAxes << rect->axes();\n  \n  foreach (QCPAxis *axis, allAxes)\n    axis->rescale(onlyVisiblePlottables);\n}\n\n/*!\n  Saves a PDF with the vectorized plot to the file \\a fileName. The axis ratio as well as the scale\n  of texts and lines will be derived from the specified \\a width and \\a height. This means, the\n  output will look like the normal on-screen output of a QCustomPlot widget with the corresponding\n  pixel width and height. If either \\a width or \\a height is zero, the exported image will have the\n  same dimensions as the QCustomPlot widget currently has.\n\n  \\a noCosmeticPen disables the use of cosmetic pens when drawing to the PDF file. Cosmetic pens\n  are pens with numerical width 0, which are always drawn as a one pixel wide line, no matter what\n  zoom factor is set in the PDF-Viewer. For more information about cosmetic pens, see the QPainter\n  and QPen documentation.\n  \n  The objects of the plot will appear in the current selection state. If you don't want any\n  selected objects to be painted in their selected look, deselect everything with \\ref deselectAll\n  before calling this function.\n\n  Returns true on success.\n  \n  \\warning\n  \\li If you plan on editing the exported PDF file with a vector graphics editor like\n  Inkscape, it is advised to set \\a noCosmeticPen to true to avoid losing those cosmetic lines\n  (which might be quite many, because cosmetic pens are the default for e.g. axes and tick marks).\n  \\li If calling this function inside the constructor of the parent of the QCustomPlot widget\n  (i.e. the MainWindow constructor, if QCustomPlot is inside the MainWindow), always provide\n  explicit non-zero widths and heights. If you leave \\a width or \\a height as 0 (default), this\n  function uses the current width and height of the QCustomPlot widget. However, in Qt, these\n  aren't defined yet inside the constructor, so you would get an image that has strange\n  widths/heights.\n  \n  \\a pdfCreator and \\a pdfTitle may be used to set the according metadata fields in the resulting\n  PDF file.\n  \n  \\note On Android systems, this method does nothing and issues an according qDebug warning\n  message. This is also the case if for other reasons the define flag QT_NO_PRINTER is set.\n  \n  \\see savePng, saveBmp, saveJpg, saveRastered\n*/\nbool QCustomPlot::savePdf(const QString &fileName, bool noCosmeticPen, int width, int height, const QString &pdfCreator, const QString &pdfTitle)\n{\n  bool success = false;\n#ifdef QT_NO_PRINTER\n  Q_UNUSED(fileName)\n  Q_UNUSED(noCosmeticPen)\n  Q_UNUSED(width)\n  Q_UNUSED(height)\n  qDebug() << Q_FUNC_INFO << \"Qt was built without printer support (QT_NO_PRINTER). PDF not created.\";\n#else\n  int newWidth, newHeight;\n  if (width == 0 || height == 0)\n  {\n    newWidth = this->width();\n    newHeight = this->height();\n  } else\n  {\n    newWidth = width;\n    newHeight = height;\n  }\n  \n  QPrinter printer(QPrinter::ScreenResolution);\n  printer.setOutputFileName(fileName);\n  printer.setOutputFormat(QPrinter::PdfFormat);\n  printer.setFullPage(true);\n  printer.setColorMode(QPrinter::Color);\n  printer.printEngine()->setProperty(QPrintEngine::PPK_Creator, pdfCreator);\n  printer.printEngine()->setProperty(QPrintEngine::PPK_DocumentName, pdfTitle);\n  QRect oldViewport = viewport();\n  setViewport(QRect(0, 0, newWidth, newHeight));\n  printer.setPaperSize(viewport().size(), QPrinter::DevicePixel);\n  QCPPainter printpainter;\n  if (printpainter.begin(&printer))\n  {\n    printpainter.setMode(QCPPainter::pmVectorized);\n    printpainter.setMode(QCPPainter::pmNoCaching);\n    printpainter.setMode(QCPPainter::pmNonCosmetic, noCosmeticPen);\n    printpainter.setWindow(mViewport);\n    if (mBackgroundBrush.style() != Qt::NoBrush &&\n        mBackgroundBrush.color() != Qt::white &&\n        mBackgroundBrush.color() != Qt::transparent &&\n        mBackgroundBrush.color().alpha() > 0) // draw pdf background color if not white/transparent\n      printpainter.fillRect(viewport(), mBackgroundBrush);\n    draw(&printpainter);\n    printpainter.end();\n    success = true;\n  }\n  setViewport(oldViewport);\n#endif // QT_NO_PRINTER\n  return success;\n}\n\n/*!\n  Saves a PNG image file to \\a fileName on disc. The output plot will have the dimensions \\a width\n  and \\a height in pixels. If either \\a width or \\a height is zero, the exported image will have\n  the same dimensions as the QCustomPlot widget currently has. Line widths and texts etc. are not\n  scaled up when larger widths/heights are used. If you want that effect, use the \\a scale parameter.\n\n  For example, if you set both \\a width and \\a height to 100 and \\a scale to 2, you will end up with an\n  image file of size 200*200 in which all graphical elements are scaled up by factor 2 (line widths,\n  texts, etc.). This scaling is not done by stretching a 100*100 image, the result will have full\n  200*200 pixel resolution.\n  \n  If you use a high scaling factor, it is recommended to enable antialiasing for all elements via\n  temporarily setting \\ref QCustomPlot::setAntialiasedElements to \\ref QCP::aeAll as this allows\n  QCustomPlot to place objects with sub-pixel accuracy.\n\n  \\warning If calling this function inside the constructor of the parent of the QCustomPlot widget\n  (i.e. the MainWindow constructor, if QCustomPlot is inside the MainWindow), always provide\n  explicit non-zero widths and heights. If you leave \\a width or \\a height as 0 (default), this\n  function uses the current width and height of the QCustomPlot widget. However, in Qt, these\n  aren't defined yet inside the constructor, so you would get an image that has strange\n  widths/heights.\n  \n  The objects of the plot will appear in the current selection state. If you don't want any selected\n  objects to be painted in their selected look, deselect everything with \\ref deselectAll before calling\n  this function.\n\n  If you want the PNG to have a transparent background, call \\ref setBackground(const QBrush\n  &brush) with no brush (Qt::NoBrush) or a transparent color (Qt::transparent), before saving.\n\n  PNG compression can be controlled with the \\a quality parameter which must be between 0 and 100 or\n  -1 to use the default setting.\n  \n  Returns true on success. If this function fails, most likely the PNG format isn't supported by\n  the system, see Qt docs about QImageWriter::supportedImageFormats().\n\n  \\see savePdf, saveBmp, saveJpg, saveRastered\n*/\nbool QCustomPlot::savePng(const QString &fileName, int width, int height, double scale, int quality)\n{\n  return saveRastered(fileName, width, height, scale, \"PNG\", quality);\n}\n\n/*!\n  Saves a JPG image file to \\a fileName on disc. The output plot will have the dimensions \\a width\n  and \\a height in pixels. If either \\a width or \\a height is zero, the exported image will have\n  the same dimensions as the QCustomPlot widget currently has. Line widths and texts etc. are not\n  scaled up when larger widths/heights are used. If you want that effect, use the \\a scale parameter.\n\n  For example, if you set both \\a width and \\a height to 100 and \\a scale to 2, you will end up with an\n  image file of size 200*200 in which all graphical elements are scaled up by factor 2 (line widths,\n  texts, etc.). This scaling is not done by stretching a 100*100 image, the result will have full\n  200*200 pixel resolution.\n  \n  If you use a high scaling factor, it is recommended to enable antialiasing for all elements via\n  temporarily setting \\ref QCustomPlot::setAntialiasedElements to \\ref QCP::aeAll as this allows\n  QCustomPlot to place objects with sub-pixel accuracy.\n\n  \\warning If calling this function inside the constructor of the parent of the QCustomPlot widget\n  (i.e. the MainWindow constructor, if QCustomPlot is inside the MainWindow), always provide\n  explicit non-zero widths and heights. If you leave \\a width or \\a height as 0 (default), this\n  function uses the current width and height of the QCustomPlot widget. However, in Qt, these\n  aren't defined yet inside the constructor, so you would get an image that has strange\n  widths/heights.\n\n  The objects of the plot will appear in the current selection state. If you don't want any selected\n  objects to be painted in their selected look, deselect everything with \\ref deselectAll before calling\n  this function.\n\n  JPG compression can be controlled with the \\a quality parameter which must be between 0 and 100 or\n  -1 to use the default setting.\n  \n  Returns true on success. If this function fails, most likely the JPG format isn't supported by\n  the system, see Qt docs about QImageWriter::supportedImageFormats().\n\n  \\see savePdf, savePng, saveBmp, saveRastered\n*/\nbool QCustomPlot::saveJpg(const QString &fileName, int width, int height, double scale, int quality)\n{\n  return saveRastered(fileName, width, height, scale, \"JPG\", quality);\n}\n\n/*!\n  Saves a BMP image file to \\a fileName on disc. The output plot will have the dimensions \\a width\n  and \\a height in pixels. If either \\a width or \\a height is zero, the exported image will have\n  the same dimensions as the QCustomPlot widget currently has. Line widths and texts etc. are not\n  scaled up when larger widths/heights are used. If you want that effect, use the \\a scale parameter.\n\n  For example, if you set both \\a width and \\a height to 100 and \\a scale to 2, you will end up with an\n  image file of size 200*200 in which all graphical elements are scaled up by factor 2 (line widths,\n  texts, etc.). This scaling is not done by stretching a 100*100 image, the result will have full\n  200*200 pixel resolution.\n  \n  If you use a high scaling factor, it is recommended to enable antialiasing for all elements via\n  temporarily setting \\ref QCustomPlot::setAntialiasedElements to \\ref QCP::aeAll as this allows\n  QCustomPlot to place objects with sub-pixel accuracy.\n\n  \\warning If calling this function inside the constructor of the parent of the QCustomPlot widget\n  (i.e. the MainWindow constructor, if QCustomPlot is inside the MainWindow), always provide\n  explicit non-zero widths and heights. If you leave \\a width or \\a height as 0 (default), this\n  function uses the current width and height of the QCustomPlot widget. However, in Qt, these\n  aren't defined yet inside the constructor, so you would get an image that has strange\n  widths/heights.\n\n  The objects of the plot will appear in the current selection state. If you don't want any selected\n  objects to be painted in their selected look, deselect everything with \\ref deselectAll before calling\n  this function.\n  \n  Returns true on success. If this function fails, most likely the BMP format isn't supported by\n  the system, see Qt docs about QImageWriter::supportedImageFormats().\n\n  \\see savePdf, savePng, saveJpg, saveRastered\n*/\nbool QCustomPlot::saveBmp(const QString &fileName, int width, int height, double scale)\n{\n  return saveRastered(fileName, width, height, scale, \"BMP\");\n}\n\n/*! \\internal\n  \n  Returns a minimum size hint that corresponds to the minimum size of the top level layout\n  (\\ref plotLayout). To prevent QCustomPlot from being collapsed to size/width zero, set a minimum\n  size (setMinimumSize) either on the whole QCustomPlot or on any layout elements inside the plot.\n  This is especially important, when placed in a QLayout where other components try to take in as\n  much space as possible (e.g. QMdiArea).\n*/\nQSize QCustomPlot::minimumSizeHint() const\n{\n  return mPlotLayout->minimumSizeHint();\n}\n\n/*! \\internal\n  \n  Returns a size hint that is the same as \\ref minimumSizeHint.\n  \n*/\nQSize QCustomPlot::sizeHint() const\n{\n  return mPlotLayout->minimumSizeHint();\n}\n\n/*! \\internal\n  \n  Event handler for when the QCustomPlot widget needs repainting. This does not cause a \\ref replot, but\n  draws the internal buffer on the widget surface.\n*/\nvoid QCustomPlot::paintEvent(QPaintEvent *event)\n{\n  Q_UNUSED(event);\n  QPainter painter(this);\n  painter.drawPixmap(0, 0, mPaintBuffer);\n}\n\n/*! \\internal\n  \n  Event handler for a resize of the QCustomPlot widget. Causes the internal buffer to be resized to\n  the new size. The viewport (which becomes the outer rect of mPlotLayout) is resized\n  appropriately. Finally a \\ref replot is performed.\n*/\nvoid QCustomPlot::resizeEvent(QResizeEvent *event)\n{\n  // resize and repaint the buffer:\n  mPaintBuffer = QPixmap(event->size());\n  setViewport(rect());\n  replot(rpQueued); // queued update is important here, to prevent painting issues in some contexts\n}\n\n/*! \\internal\n  \n Event handler for when a double click occurs. Emits the \\ref mouseDoubleClick signal, then emits\n the specialized signals when certain objecs are clicked (e.g. \\ref plottableDoubleClick, \\ref\n axisDoubleClick, etc.). Finally determines the affected layout element and forwards the event to\n it.\n \n \\see mousePressEvent, mouseReleaseEvent\n*/\nvoid QCustomPlot::mouseDoubleClickEvent(QMouseEvent *event)\n{\n  emit mouseDoubleClick(event);\n  \n  QVariant details;\n  QCPLayerable *clickedLayerable = layerableAt(event->pos(), false, &details);\n  \n  // emit specialized object double click signals:\n  if (QCPAbstractPlottable *ap = qobject_cast<QCPAbstractPlottable*>(clickedLayerable))\n    emit plottableDoubleClick(ap, event);\n  else if (QCPAxis *ax = qobject_cast<QCPAxis*>(clickedLayerable))\n    emit axisDoubleClick(ax, details.value<QCPAxis::SelectablePart>(), event);\n  else if (QCPAbstractItem *ai = qobject_cast<QCPAbstractItem*>(clickedLayerable))\n    emit itemDoubleClick(ai, event);\n  else if (QCPLegend *lg = qobject_cast<QCPLegend*>(clickedLayerable))\n    emit legendDoubleClick(lg, 0, event);\n  else if (QCPAbstractLegendItem *li = qobject_cast<QCPAbstractLegendItem*>(clickedLayerable))\n    emit legendDoubleClick(li->parentLegend(), li, event);\n  else if (QCPPlotTitle *pt = qobject_cast<QCPPlotTitle*>(clickedLayerable))\n    emit titleDoubleClick(event, pt);\n  \n  // call double click event of affected layout element:\n  if (QCPLayoutElement *el = layoutElementAt(event->pos()))\n    el->mouseDoubleClickEvent(event);\n  \n  // call release event of affected layout element (as in mouseReleaseEvent, since the mouseDoubleClick replaces the second release event in double click case):\n  if (mMouseEventElement)\n  {\n    mMouseEventElement->mouseReleaseEvent(event);\n    mMouseEventElement = 0;\n  }\n  \n  //QWidget::mouseDoubleClickEvent(event); don't call base class implementation because it would just cause a mousePress/ReleaseEvent, which we don't want.\n}\n\n/*! \\internal\n  \n  Event handler for when a mouse button is pressed. Emits the mousePress signal. Then determines\n  the affected layout element and forwards the event to it.\n  \n  \\see mouseMoveEvent, mouseReleaseEvent\n*/\nvoid QCustomPlot::mousePressEvent(QMouseEvent *event)\n{\n  emit mousePress(event);\n  mMousePressPos = event->pos(); // need this to determine in releaseEvent whether it was a click (no position change between press and release)\n  \n  // call event of affected layout element:\n  mMouseEventElement = layoutElementAt(event->pos());\n  if (mMouseEventElement)\n    mMouseEventElement->mousePressEvent(event);\n  \n  QWidget::mousePressEvent(event);\n}\n\n/*! \\internal\n  \n  Event handler for when the cursor is moved. Emits the \\ref mouseMove signal.\n\n  If a layout element has mouse capture focus (a mousePressEvent happened on top of the layout\n  element before), the mouseMoveEvent is forwarded to that element.\n  \n  \\see mousePressEvent, mouseReleaseEvent\n*/\nvoid QCustomPlot::mouseMoveEvent(QMouseEvent *event)\n{\n  emit mouseMove(event);\n\n  // call event of affected layout element:\n  if (mMouseEventElement)\n    mMouseEventElement->mouseMoveEvent(event);\n  \n  QWidget::mouseMoveEvent(event);\n}\n\n/*! \\internal\n  \n  Event handler for when a mouse button is released. Emits the \\ref mouseRelease signal.\n  \n  If the mouse was moved less than a certain threshold in any direction since the \\ref\n  mousePressEvent, it is considered a click which causes the selection mechanism (if activated via\n  \\ref setInteractions) to possibly change selection states accordingly. Further, specialized mouse\n  click signals are emitted (e.g. \\ref plottableClick, \\ref axisClick, etc.)\n  \n  If a layout element has mouse capture focus (a \\ref mousePressEvent happened on top of the layout\n  element before), the \\ref mouseReleaseEvent is forwarded to that element.\n  \n  \\see mousePressEvent, mouseMoveEvent\n*/\nvoid QCustomPlot::mouseReleaseEvent(QMouseEvent *event)\n{\n  emit mouseRelease(event);\n  bool doReplot = false;\n  \n  if ((mMousePressPos-event->pos()).manhattanLength() < 5) // determine whether it was a click operation\n  {\n    if (event->button() == Qt::LeftButton)\n    {\n      // handle selection mechanism:\n      QVariant details;\n      QCPLayerable *clickedLayerable = layerableAt(event->pos(), true, &details);\n      bool selectionStateChanged = false;\n      bool additive = mInteractions.testFlag(QCP::iMultiSelect) && event->modifiers().testFlag(mMultiSelectModifier);\n      // deselect all other layerables if not additive selection:\n      if (!additive)\n      {\n        foreach (QCPLayer *layer, mLayers)\n        {\n          foreach (QCPLayerable *layerable, layer->children())\n          {\n            if (layerable != clickedLayerable && mInteractions.testFlag(layerable->selectionCategory()))\n            {\n              bool selChanged = false;\n              layerable->deselectEvent(&selChanged);\n              selectionStateChanged |= selChanged;\n            }\n          }\n        }\n      }\n      if (clickedLayerable && mInteractions.testFlag(clickedLayerable->selectionCategory()))\n      {\n        // a layerable was actually clicked, call its selectEvent:\n        bool selChanged = false;\n        clickedLayerable->selectEvent(event, additive, details, &selChanged);\n        selectionStateChanged |= selChanged;\n      }\n      doReplot = true;\n      if (selectionStateChanged)\n        emit selectionChangedByUser();\n    }\n    \n    // emit specialized object click signals:\n    QVariant details;\n    QCPLayerable *clickedLayerable = layerableAt(event->pos(), false, &details); // for these signals, selectability is ignored, that's why we call this again with onlySelectable set to false\n    if (QCPAbstractPlottable *ap = qobject_cast<QCPAbstractPlottable*>(clickedLayerable))\n      emit plottableClick(ap, event);\n    else if (QCPAxis *ax = qobject_cast<QCPAxis*>(clickedLayerable))\n      emit axisClick(ax, details.value<QCPAxis::SelectablePart>(), event);\n    else if (QCPAbstractItem *ai = qobject_cast<QCPAbstractItem*>(clickedLayerable))\n      emit itemClick(ai, event);\n    else if (QCPLegend *lg = qobject_cast<QCPLegend*>(clickedLayerable))\n      emit legendClick(lg, 0, event);\n    else if (QCPAbstractLegendItem *li = qobject_cast<QCPAbstractLegendItem*>(clickedLayerable))\n      emit legendClick(li->parentLegend(), li, event);\n    else if (QCPPlotTitle *pt = qobject_cast<QCPPlotTitle*>(clickedLayerable))\n      emit titleClick(event, pt);\n  }\n  \n  // call event of affected layout element:\n  if (mMouseEventElement)\n  {\n    mMouseEventElement->mouseReleaseEvent(event);\n    mMouseEventElement = 0;\n  }\n  \n  if (doReplot || noAntialiasingOnDrag())\n    replot();\n  \n  QWidget::mouseReleaseEvent(event);\n}\n\n/*! \\internal\n  \n  Event handler for mouse wheel events. First, the \\ref mouseWheel signal is emitted. Then\n  determines the affected layout element and forwards the event to it.\n  \n*/\nvoid QCustomPlot::wheelEvent(QWheelEvent *event)\n{\n  emit mouseWheel(event);\n  \n  // call event of affected layout element:\n  if (QCPLayoutElement *el = layoutElementAt(event->pos()))\n    el->wheelEvent(event);\n  \n  QWidget::wheelEvent(event);\n}\n\n/*! \\internal\n  \n  This is the main draw function. It draws the entire plot, including background pixmap, with the\n  specified \\a painter. Note that it does not fill the background with the background brush (as the\n  user may specify with \\ref setBackground(const QBrush &brush)), this is up to the respective\n  functions calling this method (e.g. \\ref replot, \\ref toPixmap and \\ref toPainter).\n*/\nvoid QCustomPlot::draw(QCPPainter *painter)\n{\n  // run through layout phases:\n  mPlotLayout->update(QCPLayoutElement::upPreparation);\n  mPlotLayout->update(QCPLayoutElement::upMargins);\n  mPlotLayout->update(QCPLayoutElement::upLayout);\n  \n  // draw viewport background pixmap:\n  drawBackground(painter);\n\n  // draw all layered objects (grid, axes, plottables, items, legend,...):\n  foreach (QCPLayer *layer, mLayers)\n  {\n    foreach (QCPLayerable *child, layer->children())\n    {\n      if (child->realVisibility())\n      {\n        painter->save();\n        painter->setClipRect(child->clipRect().translated(0, -1));\n        child->applyDefaultAntialiasingHint(painter);\n        child->draw(painter);\n        painter->restore();\n      }\n    }\n  }\n  \n  /* Debug code to draw all layout element rects\n  foreach (QCPLayoutElement* el, findChildren<QCPLayoutElement*>())\n  {\n    painter->setBrush(Qt::NoBrush);\n    painter->setPen(QPen(QColor(0, 0, 0, 100), 0, Qt::DashLine));\n    painter->drawRect(el->rect());\n    painter->setPen(QPen(QColor(255, 0, 0, 100), 0, Qt::DashLine));\n    painter->drawRect(el->outerRect());\n  }\n  */\n}\n\n/*! \\internal\n  \n  Draws the viewport background pixmap of the plot.\n  \n  If a pixmap was provided via \\ref setBackground, this function buffers the scaled version\n  depending on \\ref setBackgroundScaled and \\ref setBackgroundScaledMode and then draws it inside\n  the viewport with the provided \\a painter. The scaled version is buffered in\n  mScaledBackgroundPixmap to prevent expensive rescaling at every redraw. It is only updated, when\n  the axis rect has changed in a way that requires a rescale of the background pixmap (this is\n  dependent on the \\ref setBackgroundScaledMode), or when a differend axis background pixmap was\n  set.\n  \n  Note that this function does not draw a fill with the background brush (\\ref setBackground(const\n  QBrush &brush)) beneath the pixmap.\n  \n  \\see setBackground, setBackgroundScaled, setBackgroundScaledMode\n*/\nvoid QCustomPlot::drawBackground(QCPPainter *painter)\n{\n  // Note: background color is handled in individual replot/save functions\n\n  // draw background pixmap (on top of fill, if brush specified):\n  if (!mBackgroundPixmap.isNull())\n  {\n    if (mBackgroundScaled)\n    {\n      // check whether mScaledBackground needs to be updated:\n      QSize scaledSize(mBackgroundPixmap.size());\n      scaledSize.scale(mViewport.size(), mBackgroundScaledMode);\n      if (mScaledBackgroundPixmap.size() != scaledSize)\n        mScaledBackgroundPixmap = mBackgroundPixmap.scaled(mViewport.size(), mBackgroundScaledMode, Qt::SmoothTransformation);\n      painter->drawPixmap(mViewport.topLeft(), mScaledBackgroundPixmap, QRect(0, 0, mViewport.width(), mViewport.height()) & mScaledBackgroundPixmap.rect());\n    } else\n    {\n      painter->drawPixmap(mViewport.topLeft(), mBackgroundPixmap, QRect(0, 0, mViewport.width(), mViewport.height()));\n    }\n  }\n}\n\n\n/*! \\internal\n  \n  This method is used by \\ref QCPAxisRect::removeAxis to report removed axes to the QCustomPlot\n  so it may clear its QCustomPlot::xAxis, yAxis, xAxis2 and yAxis2 members accordingly.\n*/\nvoid QCustomPlot::axisRemoved(QCPAxis *axis)\n{\n  if (xAxis == axis)\n    xAxis = 0;\n  if (xAxis2 == axis)\n    xAxis2 = 0;\n  if (yAxis == axis)\n    yAxis = 0;\n  if (yAxis2 == axis)\n    yAxis2 = 0;\n  \n  // Note: No need to take care of range drag axes and range zoom axes, because they are stored in smart pointers\n}\n\n/*! \\internal\n  \n  This method is used by the QCPLegend destructor to report legend removal to the QCustomPlot so\n  it may clear its QCustomPlot::legend member accordingly.\n*/\nvoid QCustomPlot::legendRemoved(QCPLegend *legend)\n{\n  if (this->legend == legend)\n    this->legend = 0;\n}\n\n/*! \\internal\n  \n  Assigns all layers their index (QCPLayer::mIndex) in the mLayers list. This method is thus called\n  after every operation that changes the layer indices, like layer removal, layer creation, layer\n  moving.\n*/\nvoid QCustomPlot::updateLayerIndices() const\n{\n  for (int i=0; i<mLayers.size(); ++i)\n    mLayers.at(i)->mIndex = i;\n}\n\n/*! \\internal\n  \n  Returns the layerable at pixel position \\a pos. If \\a onlySelectable is set to true, only those\n  layerables that are selectable will be considered. (Layerable subclasses communicate their\n  selectability via the QCPLayerable::selectTest method, by returning -1.)\n\n  \\a selectionDetails is an output parameter that contains selection specifics of the affected\n  layerable. This is useful if the respective layerable shall be given a subsequent\n  QCPLayerable::selectEvent (like in \\ref mouseReleaseEvent). \\a selectionDetails usually contains\n  information about which part of the layerable was hit, in multi-part layerables (e.g.\n  QCPAxis::SelectablePart).\n*/\nQCPLayerable *QCustomPlot::layerableAt(const QPointF &pos, bool onlySelectable, QVariant *selectionDetails) const\n{\n  for (int layerIndex=mLayers.size()-1; layerIndex>=0; --layerIndex)\n  {\n    const QList<QCPLayerable*> layerables = mLayers.at(layerIndex)->children();\n    double minimumDistance = selectionTolerance()*1.1;\n    QCPLayerable *minimumDistanceLayerable = 0;\n    for (int i=layerables.size()-1; i>=0; --i)\n    {\n      if (!layerables.at(i)->realVisibility())\n        continue;\n      QVariant details;\n      double dist = layerables.at(i)->selectTest(pos, onlySelectable, &details);\n      if (dist >= 0 && dist < minimumDistance)\n      {\n        minimumDistance = dist;\n        minimumDistanceLayerable = layerables.at(i);\n        if (selectionDetails) *selectionDetails = details;\n      }\n    }\n    if (minimumDistance < selectionTolerance())\n      return minimumDistanceLayerable;\n  }\n  return 0;\n}\n\n/*!\n  Saves the plot to a rastered image file \\a fileName in the image format \\a format. The plot is\n  sized to \\a width and \\a height in pixels and scaled with \\a scale. (width 100 and scale 2.0 lead\n  to a full resolution file with width 200.) If the \\a format supports compression, \\a quality may\n  be between 0 and 100 to control it.\n  \n  Returns true on success. If this function fails, most likely the given \\a format isn't supported\n  by the system, see Qt docs about QImageWriter::supportedImageFormats().\n  \n  \\see saveBmp, saveJpg, savePng, savePdf\n*/\nbool QCustomPlot::saveRastered(const QString &fileName, int width, int height, double scale, const char *format, int quality)\n{\n  QPixmap buffer = toPixmap(width, height, scale);\n  if (!buffer.isNull())\n    return buffer.save(fileName, format, quality);\n  else\n    return false;\n}\n\n/*!\n  Renders the plot to a pixmap and returns it.\n  \n  The plot is sized to \\a width and \\a height in pixels and scaled with \\a scale. (width 100 and\n  scale 2.0 lead to a full resolution pixmap with width 200.)\n  \n  \\see toPainter, saveRastered, saveBmp, savePng, saveJpg, savePdf\n*/\nQPixmap QCustomPlot::toPixmap(int width, int height, double scale)\n{\n  // this method is somewhat similar to toPainter. Change something here, and a change in toPainter might be necessary, too.\n  int newWidth, newHeight;\n  if (width == 0 || height == 0)\n  {\n    newWidth = this->width();\n    newHeight = this->height();\n  } else\n  {\n    newWidth = width;\n    newHeight = height;\n  }\n  int scaledWidth = qRound(scale*newWidth);\n  int scaledHeight = qRound(scale*newHeight);\n\n  QPixmap result(scaledWidth, scaledHeight);\n  result.fill(mBackgroundBrush.style() == Qt::SolidPattern ? mBackgroundBrush.color() : Qt::transparent); // if using non-solid pattern, make transparent now and draw brush pattern later\n  QCPPainter painter;\n  painter.begin(&result);\n  if (painter.isActive())\n  {\n    QRect oldViewport = viewport();\n    setViewport(QRect(0, 0, newWidth, newHeight));\n    painter.setMode(QCPPainter::pmNoCaching);\n    if (!qFuzzyCompare(scale, 1.0))\n    {\n      if (scale > 1.0) // for scale < 1 we always want cosmetic pens where possible, because else lines might disappear for very small scales\n        painter.setMode(QCPPainter::pmNonCosmetic);\n      painter.scale(scale, scale);\n    }\n    if (mBackgroundBrush.style() != Qt::SolidPattern && mBackgroundBrush.style() != Qt::NoBrush)\n      painter.fillRect(mViewport, mBackgroundBrush);\n    draw(&painter);\n    setViewport(oldViewport);\n    painter.end();\n  } else // might happen if pixmap has width or height zero\n  {\n    qDebug() << Q_FUNC_INFO << \"Couldn't activate painter on pixmap\";\n    return QPixmap();\n  }\n  return result;\n}\n\n/*!\n  Renders the plot using the passed \\a painter.\n  \n  The plot is sized to \\a width and \\a height in pixels. If the \\a painter's scale is not 1.0, the resulting plot will\n  appear scaled accordingly.\n  \n  \\note If you are restricted to using a QPainter (instead of QCPPainter), create a temporary QPicture and open a QCPPainter\n  on it. Then call \\ref toPainter with this QCPPainter. After ending the paint operation on the picture, draw it with\n  the QPainter. This will reproduce the painter actions the QCPPainter took, with a QPainter.\n  \n  \\see toPixmap\n*/\nvoid QCustomPlot::toPainter(QCPPainter *painter, int width, int height)\n{\n  // this method is somewhat similar to toPixmap. Change something here, and a change in toPixmap might be necessary, too.\n  int newWidth, newHeight;\n  if (width == 0 || height == 0)\n  {\n    newWidth = this->width();\n    newHeight = this->height();\n  } else\n  {\n    newWidth = width;\n    newHeight = height;\n  }\n\n  if (painter->isActive())\n  {\n    QRect oldViewport = viewport();\n    setViewport(QRect(0, 0, newWidth, newHeight));\n    painter->setMode(QCPPainter::pmNoCaching);\n    // warning: the following is different in toPixmap, because a solid background color is applied there via QPixmap::fill\n    // here, we need to do this via QPainter::fillRect.\n    if (mBackgroundBrush.style() != Qt::NoBrush)\n      painter->fillRect(mViewport, mBackgroundBrush);\n    draw(painter);\n    setViewport(oldViewport);\n  } else\n    qDebug() << Q_FUNC_INFO << \"Passed painter is not active\";\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPColorGradient\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPColorGradient\n  \\brief Defines a color gradient for use with e.g. \\ref QCPColorMap\n  \n  This class describes a color gradient which can be used to encode data with color. For example,\n  QCPColorMap and QCPColorScale have a \\ref QCPColorMap::setGradient \"setGradient\" method which\n  takes an instance of this class. Colors are set with \\ref setColorStopAt(double position, const QColor &color)\n  with a \\a position from 0 to 1. In between these defined color positions, the\n  color will be interpolated linearly either in RGB or HSV space, see \\ref setColorInterpolation.\n\n  Alternatively, load one of the preset color gradients shown in the image below, with \\ref\n  loadPreset, or by directly specifying the preset in the constructor.\n  \n  \\image html QCPColorGradient.png\n  \n  The fact that the \\ref QCPColorGradient(GradientPreset preset) constructor allows directly\n  converting a \\ref GradientPreset to a QCPColorGradient, you can also directly pass \\ref\n  GradientPreset to all the \\a setGradient methods, e.g.:\n  \\code\n  colorMap->setGradient(QCPColorGradient::gpHot);\n  \\endcode\n  \n  The total number of levels used in the gradient can be set with \\ref setLevelCount. Whether the\n  color gradient shall be applied periodically (wrapping around) to data values that lie outside\n  the data range specified on the plottable instance can be controlled with \\ref setPeriodic.\n*/\n\n/*!\n  Constructs a new QCPColorGradient initialized with the colors and color interpolation according\n  to \\a preset.\n  \n  The color level count is initialized to 350.\n*/\nQCPColorGradient::QCPColorGradient(GradientPreset preset) :\n  mLevelCount(350),\n  mColorInterpolation(ciRGB),\n  mPeriodic(false),\n  mColorBufferInvalidated(true)\n{\n  mColorBuffer.fill(qRgb(0, 0, 0), mLevelCount);\n  loadPreset(preset);\n}\n\n/* undocumented operator */\nbool QCPColorGradient::operator==(const QCPColorGradient &other) const\n{\n  return ((other.mLevelCount == this->mLevelCount) &&\n          (other.mColorInterpolation == this->mColorInterpolation) &&\n          (other.mPeriodic == this->mPeriodic) &&\n          (other.mColorStops == this->mColorStops));\n}\n\n/*!\n  Sets the number of discretization levels of the color gradient to \\a n. The default is 350 which\n  is typically enough to create a smooth appearance.\n  \n  \\image html QCPColorGradient-levelcount.png\n*/\nvoid QCPColorGradient::setLevelCount(int n)\n{\n  if (n < 2)\n  {\n    qDebug() << Q_FUNC_INFO << \"n must be greater or equal 2 but was\" << n;\n    n = 2;\n  }\n  if (n != mLevelCount)\n  {\n    mLevelCount = n;\n    mColorBufferInvalidated = true;\n  }\n}\n\n/*!\n  Sets at which positions from 0 to 1 which color shall occur. The positions are the keys, the\n  colors are the values of the passed QMap \\a colorStops. In between these color stops, the color\n  is interpolated according to \\ref setColorInterpolation.\n  \n  A more convenient way to create a custom gradient may be to clear all color stops with \\ref\n  clearColorStops and then adding them one by one with \\ref setColorStopAt.\n  \n  \\see clearColorStops\n*/\nvoid QCPColorGradient::setColorStops(const QMap<double, QColor> &colorStops)\n{\n  mColorStops = colorStops;\n  mColorBufferInvalidated = true;\n}\n\n/*!\n  Sets the \\a color the gradient will have at the specified \\a position (from 0 to 1). In between\n  these color stops, the color is interpolated according to \\ref setColorInterpolation.\n  \n  \\see setColorStops, clearColorStops\n*/\nvoid QCPColorGradient::setColorStopAt(double position, const QColor &color)\n{\n  mColorStops.insert(position, color);\n  mColorBufferInvalidated = true;\n}\n\n/*!\n  Sets whether the colors in between the configured color stops (see \\ref setColorStopAt) shall be\n  interpolated linearly in RGB or in HSV color space.\n  \n  For example, a sweep in RGB space from red to green will have a muddy brown intermediate color,\n  whereas in HSV space the intermediate color is yellow.\n*/\nvoid QCPColorGradient::setColorInterpolation(QCPColorGradient::ColorInterpolation interpolation)\n{\n  if (interpolation != mColorInterpolation)\n  {\n    mColorInterpolation = interpolation;\n    mColorBufferInvalidated = true;\n  }\n}\n\n/*!\n  Sets whether data points that are outside the configured data range (e.g. \\ref\n  QCPColorMap::setDataRange) are colored by periodically repeating the color gradient or whether\n  they all have the same color, corresponding to the respective gradient boundary color.\n  \n  \\image html QCPColorGradient-periodic.png\n  \n  As shown in the image above, gradients that have the same start and end color are especially\n  suitable for a periodic gradient mapping, since they produce smooth color transitions throughout\n  the color map. A preset that has this property is \\ref gpHues.\n  \n  In practice, using periodic color gradients makes sense when the data corresponds to a periodic\n  dimension, such as an angle or a phase. If this is not the case, the color encoding might become\n  ambiguous, because multiple different data values are shown as the same color.\n*/\nvoid QCPColorGradient::setPeriodic(bool enabled)\n{\n  mPeriodic = enabled;\n}\n\n/*!\n  This method is used to quickly convert a \\a data array to colors. The colors will be output in\n  the array \\a scanLine. Both \\a data and \\a scanLine must have the length \\a n when passed to this\n  function. The data range that shall be used for mapping the data value to the gradient is passed\n  in \\a range. \\a logarithmic indicates whether the data values shall be mapped to colors\n  logarithmically.\n  \n  if \\a data actually contains 2D-data linearized via <tt>[row*columnCount + column]</tt>, you can\n  set \\a dataIndexFactor to <tt>columnCount</tt> to convert a column instead of a row of the data\n  array, in \\a scanLine. \\a scanLine will remain a regular (1D) array. This works because \\a data\n  is addressed <tt>data[i*dataIndexFactor]</tt>.\n*/\nvoid QCPColorGradient::colorize(const double *data, const QCPRange &range, QRgb *scanLine, int n, int dataIndexFactor, bool logarithmic)\n{\n  // If you change something here, make sure to also adapt ::color()\n  if (!data)\n  {\n    qDebug() << Q_FUNC_INFO << \"null pointer given as data\";\n    return;\n  }\n  if (!scanLine)\n  {\n    qDebug() << Q_FUNC_INFO << \"null pointer given as scanLine\";\n    return;\n  }\n  if (mColorBufferInvalidated)\n    updateColorBuffer();\n  \n  if (!logarithmic)\n  {\n    const double posToIndexFactor = mLevelCount/range.size();\n    if (mPeriodic)\n    {\n      for (int i=0; i<n; ++i)\n      {\n        int index = (int)((data[dataIndexFactor*i]-range.lower)*posToIndexFactor) % mLevelCount;\n        if (index < 0)\n          index += mLevelCount;\n        scanLine[i] = mColorBuffer.at(index);\n      }\n    } else\n    {\n      for (int i=0; i<n; ++i)\n      {\n        int index = (data[dataIndexFactor*i]-range.lower)*posToIndexFactor;\n        if (index < 0)\n          index = 0;\n        else if (index >= mLevelCount)\n          index = mLevelCount-1;\n        scanLine[i] = mColorBuffer.at(index);\n      }\n    }\n  } else // logarithmic == true\n  {\n    if (mPeriodic)\n    {\n      for (int i=0; i<n; ++i)\n      {\n        int index = (int)(qLn(data[dataIndexFactor*i]/range.lower)/qLn(range.upper/range.lower)*mLevelCount) % mLevelCount;\n        if (index < 0)\n          index += mLevelCount;\n        scanLine[i] = mColorBuffer.at(index);\n      }\n    } else\n    {\n      for (int i=0; i<n; ++i)\n      {\n        int index = qLn(data[dataIndexFactor*i]/range.lower)/qLn(range.upper/range.lower)*mLevelCount;\n        if (index < 0)\n          index = 0;\n        else if (index >= mLevelCount)\n          index = mLevelCount-1;\n        scanLine[i] = mColorBuffer.at(index);\n      }\n    }\n  }\n}\n\n/*! \\internal\n  \n  This method is used to colorize a single data value given in \\a position, to colors. The data\n  range that shall be used for mapping the data value to the gradient is passed in \\a range. \\a\n  logarithmic indicates whether the data value shall be mapped to a color logarithmically.\n  \n  If an entire array of data values shall be converted, rather use \\ref colorize, for better\n  performance.\n*/\nQRgb QCPColorGradient::color(double position, const QCPRange &range, bool logarithmic)\n{\n  // If you change something here, make sure to also adapt ::colorize()\n  if (mColorBufferInvalidated)\n    updateColorBuffer();\n  int index = 0;\n  if (!logarithmic)\n    index = (position-range.lower)*mLevelCount/range.size();\n  else\n    index = qLn(position/range.lower)/qLn(range.upper/range.lower)*mLevelCount;\n  if (mPeriodic)\n  {\n    index = index % mLevelCount;\n    if (index < 0)\n      index += mLevelCount;\n  } else\n  {\n    if (index < 0)\n      index = 0;\n    else if (index >= mLevelCount)\n      index = mLevelCount-1;\n  }\n  return mColorBuffer.at(index);\n}\n\n/*!\n  Clears the current color stops and loads the specified \\a preset. A preset consists of predefined\n  color stops and the corresponding color interpolation method.\n  \n  The available presets are:\n  \\image html QCPColorGradient.png\n*/\nvoid QCPColorGradient::loadPreset(GradientPreset preset)\n{\n  clearColorStops();\n  switch (preset)\n  {\n    case gpGrayscale:\n      setColorInterpolation(ciRGB);\n      setColorStopAt(0, Qt::black);\n      setColorStopAt(1, Qt::white);\n      break;\n    case gpHot:\n      setColorInterpolation(ciRGB);\n      setColorStopAt(0, QColor(50, 0, 0));\n      setColorStopAt(0.2, QColor(180, 10, 0));\n      setColorStopAt(0.4, QColor(245, 50, 0));\n      setColorStopAt(0.6, QColor(255, 150, 10));\n      setColorStopAt(0.8, QColor(255, 255, 50));\n      setColorStopAt(1, QColor(255, 255, 255));\n      break;\n    case gpCold:\n      setColorInterpolation(ciRGB);\n      setColorStopAt(0, QColor(0, 0, 50));\n      setColorStopAt(0.2, QColor(0, 10, 180));\n      setColorStopAt(0.4, QColor(0, 50, 245));\n      setColorStopAt(0.6, QColor(10, 150, 255));\n      setColorStopAt(0.8, QColor(50, 255, 255));\n      setColorStopAt(1, QColor(255, 255, 255));\n      break;\n    case gpNight:\n      setColorInterpolation(ciHSV);\n      setColorStopAt(0, QColor(10, 20, 30));\n      setColorStopAt(1, QColor(250, 255, 250));\n      break;\n    case gpCandy:\n      setColorInterpolation(ciHSV);\n      setColorStopAt(0, QColor(0, 0, 255));\n      setColorStopAt(1, QColor(255, 250, 250));\n      break;\n    case gpGeography:\n      setColorInterpolation(ciRGB);\n      setColorStopAt(0, QColor(70, 170, 210));\n      setColorStopAt(0.20, QColor(90, 160, 180));\n      setColorStopAt(0.25, QColor(45, 130, 175));\n      setColorStopAt(0.30, QColor(100, 140, 125));\n      setColorStopAt(0.5, QColor(100, 140, 100));\n      setColorStopAt(0.6, QColor(130, 145, 120));\n      setColorStopAt(0.7, QColor(140, 130, 120));\n      setColorStopAt(0.9, QColor(180, 190, 190));\n      setColorStopAt(1, QColor(210, 210, 230));\n      break;\n    case gpIon:\n      setColorInterpolation(ciHSV);\n      setColorStopAt(0, QColor(50, 10, 10));\n      setColorStopAt(0.45, QColor(0, 0, 255));\n      setColorStopAt(0.8, QColor(0, 255, 255));\n      setColorStopAt(1, QColor(0, 255, 0));\n      break;\n    case gpThermal:\n      setColorInterpolation(ciRGB);\n      setColorStopAt(0, QColor(0, 0, 50));\n      setColorStopAt(0.15, QColor(20, 0, 120));\n      setColorStopAt(0.33, QColor(200, 30, 140));\n      setColorStopAt(0.6, QColor(255, 100, 0));\n      setColorStopAt(0.85, QColor(255, 255, 40));\n      setColorStopAt(1, QColor(255, 255, 255));\n      break;\n    case gpPolar:\n      setColorInterpolation(ciRGB);\n      setColorStopAt(0, QColor(50, 255, 255));\n      setColorStopAt(0.18, QColor(10, 70, 255));\n      setColorStopAt(0.28, QColor(10, 10, 190));\n      setColorStopAt(0.5, QColor(0, 0, 0));\n      setColorStopAt(0.72, QColor(190, 10, 10));\n      setColorStopAt(0.82, QColor(255, 70, 10));\n      setColorStopAt(1, QColor(255, 255, 50));\n      break;\n    case gpSpectrum:\n      setColorInterpolation(ciHSV);\n      setColorStopAt(0, QColor(50, 0, 50));\n      setColorStopAt(0.15, QColor(0, 0, 255));\n      setColorStopAt(0.35, QColor(0, 255, 255));\n      setColorStopAt(0.6, QColor(255, 255, 0));\n      setColorStopAt(0.75, QColor(255, 30, 0));\n      setColorStopAt(1, QColor(50, 0, 0));\n      break;\n    case gpJet:\n      setColorInterpolation(ciRGB);\n      setColorStopAt(0, QColor(0, 0, 100));\n      setColorStopAt(0.15, QColor(0, 50, 255));\n      setColorStopAt(0.35, QColor(0, 255, 255));\n      setColorStopAt(0.65, QColor(255, 255, 0));\n      setColorStopAt(0.85, QColor(255, 30, 0));\n      setColorStopAt(1, QColor(100, 0, 0));\n      break;\n    case gpHues:\n      setColorInterpolation(ciHSV);\n      setColorStopAt(0, QColor(255, 0, 0));\n      setColorStopAt(1.0/3.0, QColor(0, 0, 255));\n      setColorStopAt(2.0/3.0, QColor(0, 255, 0));\n      setColorStopAt(1, QColor(255, 0, 0));\n      break;\n  }\n}\n\n/*!\n  Clears all color stops.\n  \n  \\see setColorStops, setColorStopAt\n*/\nvoid QCPColorGradient::clearColorStops()\n{\n  mColorStops.clear();\n  mColorBufferInvalidated = true;\n}\n\n/*!\n  Returns an inverted gradient. The inverted gradient has all properties as this \\ref\n  QCPColorGradient, but the order of the color stops is inverted.\n  \n  \\see setColorStops, setColorStopAt\n*/\nQCPColorGradient QCPColorGradient::inverted() const\n{\n  QCPColorGradient result(*this);\n  result.clearColorStops();\n  for (QMap<double, QColor>::const_iterator it=mColorStops.constBegin(); it!=mColorStops.constEnd(); ++it)\n    result.setColorStopAt(1.0-it.key(), it.value());\n  return result;\n}\n\n/*! \\internal\n  \n  Updates the internal color buffer which will be used by \\ref colorize and \\ref color, to quickly\n  convert positions to colors. This is where the interpolation between color stops is calculated.\n*/\nvoid QCPColorGradient::updateColorBuffer()\n{\n  if (mColorBuffer.size() != mLevelCount)\n    mColorBuffer.resize(mLevelCount);\n  if (mColorStops.size() > 1)\n  {\n    double indexToPosFactor = 1.0/(double)(mLevelCount-1);\n    for (int i=0; i<mLevelCount; ++i)\n    {\n      double position = i*indexToPosFactor;\n      QMap<double, QColor>::const_iterator it = mColorStops.lowerBound(position);\n      if (it == mColorStops.constEnd()) // position is on or after last stop, use color of last stop\n      {\n        mColorBuffer[i] = (it-1).value().rgb();\n      } else if (it == mColorStops.constBegin()) // position is on or before first stop, use color of first stop\n      {\n        mColorBuffer[i] = it.value().rgb();\n      } else // position is in between stops (or on an intermediate stop), interpolate color\n      {\n        QMap<double, QColor>::const_iterator high = it;\n        QMap<double, QColor>::const_iterator low = it-1;\n        double t = (position-low.key())/(high.key()-low.key()); // interpolation factor 0..1\n        switch (mColorInterpolation)\n        {\n          case ciRGB:\n          {\n            mColorBuffer[i] = qRgb((1-t)*low.value().red() + t*high.value().red(),\n                                   (1-t)*low.value().green() + t*high.value().green(),\n                                   (1-t)*low.value().blue() + t*high.value().blue());\n            break;\n          }\n          case ciHSV:\n          {\n            QColor lowHsv = low.value().toHsv();\n            QColor highHsv = high.value().toHsv();\n            double hue = 0;\n            double hueDiff = highHsv.hueF()-lowHsv.hueF();\n            if (hueDiff > 0.5)\n              hue = lowHsv.hueF() - t*(1.0-hueDiff);\n            else if (hueDiff < -0.5)\n              hue = lowHsv.hueF() + t*(1.0+hueDiff);\n            else\n              hue = lowHsv.hueF() + t*hueDiff;\n            if (hue < 0) hue += 1.0;\n            else if (hue >= 1.0) hue -= 1.0;\n            mColorBuffer[i] = QColor::fromHsvF(hue, (1-t)*lowHsv.saturationF() + t*highHsv.saturationF(), (1-t)*lowHsv.valueF() + t*highHsv.valueF()).rgb();\n            break;\n          }\n        }\n      }\n    }\n  } else if (mColorStops.size() == 1)\n  {\n    mColorBuffer.fill(mColorStops.constBegin().value().rgb());\n  } else // mColorStops is empty, fill color buffer with black\n  {\n    mColorBuffer.fill(qRgb(0, 0, 0));\n  }\n  mColorBufferInvalidated = false;\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPAxisRect\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPAxisRect\n  \\brief Holds multiple axes and arranges them in a rectangular shape.\n  \n  This class represents an axis rect, a rectangular area that is bounded on all sides with an\n  arbitrary number of axes.\n  \n  Initially QCustomPlot has one axis rect, accessible via QCustomPlot::axisRect(). However, the\n  layout system allows to have multiple axis rects, e.g. arranged in a grid layout\n  (QCustomPlot::plotLayout).\n  \n  By default, QCPAxisRect comes with four axes, at bottom, top, left and right. They can be\n  accessed via \\ref axis by providing the respective axis type (\\ref QCPAxis::AxisType) and index.\n  If you need all axes in the axis rect, use \\ref axes. The top and right axes are set to be\n  invisible initially (QCPAxis::setVisible). To add more axes to a side, use \\ref addAxis or \\ref\n  addAxes. To remove an axis, use \\ref removeAxis.\n  \n  The axis rect layerable itself only draws a background pixmap or color, if specified (\\ref\n  setBackground). It is placed on the \"background\" layer initially (see \\ref QCPLayer for an\n  explanation of the QCustomPlot layer system). The axes that are held by the axis rect can be\n  placed on other layers, independently of the axis rect.\n  \n  Every axis rect has a child layout of type \\ref QCPLayoutInset. It is accessible via \\ref\n  insetLayout and can be used to have other layout elements (or even other layouts with multiple\n  elements) hovering inside the axis rect.\n  \n  If an axis rect is clicked and dragged, it processes this by moving certain axis ranges. The\n  behaviour can be controlled with \\ref setRangeDrag and \\ref setRangeDragAxes. If the mouse wheel\n  is scrolled while the cursor is on the axis rect, certain axes are scaled. This is controllable\n  via \\ref setRangeZoom, \\ref setRangeZoomAxes and \\ref setRangeZoomFactor. These interactions are\n  only enabled if \\ref QCustomPlot::setInteractions contains \\ref QCP::iRangeDrag and \\ref\n  QCP::iRangeZoom.\n  \n  \\image html AxisRectSpacingOverview.png\n  <center>Overview of the spacings and paddings that define the geometry of an axis. The dashed\n  line on the far left indicates the viewport/widget border.</center>\n*/\n\n/* start documentation of inline functions */\n\n/*! \\fn QCPLayoutInset *QCPAxisRect::insetLayout() const\n  \n  Returns the inset layout of this axis rect. It can be used to place other layout elements (or\n  even layouts with multiple other elements) inside/on top of an axis rect.\n  \n  \\see QCPLayoutInset\n*/\n\n/*! \\fn int QCPAxisRect::left() const\n  \n  Returns the pixel position of the left border of this axis rect. Margins are not taken into\n  account here, so the returned value is with respect to the inner \\ref rect.\n*/\n\n/*! \\fn int QCPAxisRect::right() const\n  \n  Returns the pixel position of the right border of this axis rect. Margins are not taken into\n  account here, so the returned value is with respect to the inner \\ref rect.\n*/\n\n/*! \\fn int QCPAxisRect::top() const\n  \n  Returns the pixel position of the top border of this axis rect. Margins are not taken into\n  account here, so the returned value is with respect to the inner \\ref rect.\n*/\n\n/*! \\fn int QCPAxisRect::bottom() const\n  \n  Returns the pixel position of the bottom border of this axis rect. Margins are not taken into\n  account here, so the returned value is with respect to the inner \\ref rect.\n*/\n\n/*! \\fn int QCPAxisRect::width() const\n  \n  Returns the pixel width of this axis rect. Margins are not taken into account here, so the\n  returned value is with respect to the inner \\ref rect.\n*/\n\n/*! \\fn int QCPAxisRect::height() const\n  \n  Returns the pixel height of this axis rect. Margins are not taken into account here, so the\n  returned value is with respect to the inner \\ref rect.\n*/\n\n/*! \\fn QSize QCPAxisRect::size() const\n  \n  Returns the pixel size of this axis rect. Margins are not taken into account here, so the\n  returned value is with respect to the inner \\ref rect.\n*/\n\n/*! \\fn QPoint QCPAxisRect::topLeft() const\n  \n  Returns the top left corner of this axis rect in pixels. Margins are not taken into account here,\n  so the returned value is with respect to the inner \\ref rect.\n*/\n\n/*! \\fn QPoint QCPAxisRect::topRight() const\n  \n  Returns the top right corner of this axis rect in pixels. Margins are not taken into account\n  here, so the returned value is with respect to the inner \\ref rect.\n*/\n\n/*! \\fn QPoint QCPAxisRect::bottomLeft() const\n  \n  Returns the bottom left corner of this axis rect in pixels. Margins are not taken into account\n  here, so the returned value is with respect to the inner \\ref rect.\n*/\n\n/*! \\fn QPoint QCPAxisRect::bottomRight() const\n  \n  Returns the bottom right corner of this axis rect in pixels. Margins are not taken into account\n  here, so the returned value is with respect to the inner \\ref rect.\n*/\n\n/*! \\fn QPoint QCPAxisRect::center() const\n  \n  Returns the center of this axis rect in pixels. Margins are not taken into account here, so the\n  returned value is with respect to the inner \\ref rect.\n*/\n\n/* end documentation of inline functions */\n\n/*!\n  Creates a QCPAxisRect instance and sets default values. An axis is added for each of the four\n  sides, the top and right axes are set invisible initially.\n*/\nQCPAxisRect::QCPAxisRect(QCustomPlot *parentPlot, bool setupDefaultAxes) :\n  QCPLayoutElement(parentPlot),\n  mBackgroundBrush(Qt::NoBrush),\n  mBackgroundScaled(true),\n  mBackgroundScaledMode(Qt::KeepAspectRatioByExpanding),\n  mInsetLayout(new QCPLayoutInset),\n  mRangeDrag(Qt::Horizontal|Qt::Vertical),\n  mRangeZoom(Qt::Horizontal|Qt::Vertical),\n  mRangeZoomFactorHorz(0.85),\n  mRangeZoomFactorVert(0.85),\n  mDragging(false)\n{\n  mInsetLayout->initializeParentPlot(mParentPlot);\n  mInsetLayout->setParentLayerable(this);\n  mInsetLayout->setParent(this);\n  \n  setMinimumSize(50, 50);\n  setMinimumMargins(QMargins(15, 15, 15, 15));\n  mAxes.insert(QCPAxis::atLeft, QList<QCPAxis*>());\n  mAxes.insert(QCPAxis::atRight, QList<QCPAxis*>());\n  mAxes.insert(QCPAxis::atTop, QList<QCPAxis*>());\n  mAxes.insert(QCPAxis::atBottom, QList<QCPAxis*>());\n  \n  if (setupDefaultAxes)\n  {\n    QCPAxis *xAxis = addAxis(QCPAxis::atBottom);\n    QCPAxis *yAxis = addAxis(QCPAxis::atLeft);\n    QCPAxis *xAxis2 = addAxis(QCPAxis::atTop);\n    QCPAxis *yAxis2 = addAxis(QCPAxis::atRight);\n    setRangeDragAxes(xAxis, yAxis);\n    setRangeZoomAxes(xAxis, yAxis);\n    xAxis2->setVisible(false);\n    yAxis2->setVisible(false);\n    xAxis->grid()->setVisible(true);\n    yAxis->grid()->setVisible(true);\n    xAxis2->grid()->setVisible(false);\n    yAxis2->grid()->setVisible(false);\n    xAxis2->grid()->setZeroLinePen(Qt::NoPen);\n    yAxis2->grid()->setZeroLinePen(Qt::NoPen);\n    xAxis2->grid()->setVisible(false);\n    yAxis2->grid()->setVisible(false);\n  }\n}\n\nQCPAxisRect::~QCPAxisRect()\n{\n  delete mInsetLayout;\n  mInsetLayout = 0;\n  \n  QList<QCPAxis*> axesList = axes();\n  for (int i=0; i<axesList.size(); ++i)\n    removeAxis(axesList.at(i));\n}\n\n/*!\n  Returns the number of axes on the axis rect side specified with \\a type.\n  \n  \\see axis\n*/\nint QCPAxisRect::axisCount(QCPAxis::AxisType type) const\n{\n  return mAxes.value(type).size();\n}\n\n/*!\n  Returns the axis with the given \\a index on the axis rect side specified with \\a type.\n  \n  \\see axisCount, axes\n*/\nQCPAxis *QCPAxisRect::axis(QCPAxis::AxisType type, int index) const\n{\n  QList<QCPAxis*> ax(mAxes.value(type));\n  if (index >= 0 && index < ax.size())\n  {\n    return ax.at(index);\n  } else\n  {\n    qDebug() << Q_FUNC_INFO << \"Axis index out of bounds:\" << index;\n    return 0;\n  }\n}\n\n/*!\n  Returns all axes on the axis rect sides specified with \\a types.\n  \n  \\a types may be a single \\ref QCPAxis::AxisType or an <tt>or</tt>-combination, to get the axes of\n  multiple sides.\n  \n  \\see axis\n*/\nQList<QCPAxis*> QCPAxisRect::axes(QCPAxis::AxisTypes types) const\n{\n  QList<QCPAxis*> result;\n  if (types.testFlag(QCPAxis::atLeft))\n    result << mAxes.value(QCPAxis::atLeft);\n  if (types.testFlag(QCPAxis::atRight))\n    result << mAxes.value(QCPAxis::atRight);\n  if (types.testFlag(QCPAxis::atTop))\n    result << mAxes.value(QCPAxis::atTop);\n  if (types.testFlag(QCPAxis::atBottom))\n    result << mAxes.value(QCPAxis::atBottom);\n  return result;\n}\n\n/*! \\overload\n  \n  Returns all axes of this axis rect.\n*/\nQList<QCPAxis*> QCPAxisRect::axes() const\n{\n  QList<QCPAxis*> result;\n  QHashIterator<QCPAxis::AxisType, QList<QCPAxis*> > it(mAxes);\n  while (it.hasNext())\n  {\n    it.next();\n    result << it.value();\n  }\n  return result;\n}\n\n/*!\n  Adds a new axis to the axis rect side specified with \\a type, and returns it.\n  \n  If an axis rect side already contains one or more axes, the lower and upper endings of the new\n  axis (\\ref QCPAxis::setLowerEnding, \\ref QCPAxis::setUpperEnding) are initialized to \\ref\n  QCPLineEnding::esHalfBar.\n  \n  \\see addAxes, setupFullAxesBox\n*/\nQCPAxis *QCPAxisRect::addAxis(QCPAxis::AxisType type)\n{\n  QCPAxis *newAxis = new QCPAxis(this, type);\n  if (mAxes[type].size() > 0) // multiple axes on one side, add half-bar axis ending to additional axes with offset\n  {\n    bool invert = (type == QCPAxis::atRight) || (type == QCPAxis::atBottom);\n    newAxis->setLowerEnding(QCPLineEnding(QCPLineEnding::esHalfBar, 6, 10, !invert));\n    newAxis->setUpperEnding(QCPLineEnding(QCPLineEnding::esHalfBar, 6, 10, invert));\n  }\n  mAxes[type].append(newAxis);\n  return newAxis;\n}\n\n/*!\n  Adds a new axis with \\ref addAxis to each axis rect side specified in \\a types. This may be an\n  <tt>or</tt>-combination of QCPAxis::AxisType, so axes can be added to multiple sides at once.\n  \n  Returns a list of the added axes.\n  \n  \\see addAxis, setupFullAxesBox\n*/\nQList<QCPAxis*> QCPAxisRect::addAxes(QCPAxis::AxisTypes types)\n{\n  QList<QCPAxis*> result;\n  if (types.testFlag(QCPAxis::atLeft))\n    result << addAxis(QCPAxis::atLeft);\n  if (types.testFlag(QCPAxis::atRight))\n    result << addAxis(QCPAxis::atRight);\n  if (types.testFlag(QCPAxis::atTop))\n    result << addAxis(QCPAxis::atTop);\n  if (types.testFlag(QCPAxis::atBottom))\n    result << addAxis(QCPAxis::atBottom);\n  return result;\n}\n\n/*!\n  Removes the specified \\a axis from the axis rect and deletes it.\n  \n  Returns true on success, i.e. if \\a axis was a valid axis in this axis rect.\n  \n  \\see addAxis\n*/\nbool QCPAxisRect::removeAxis(QCPAxis *axis)\n{\n  // don't access axis->axisType() to provide safety when axis is an invalid pointer, rather go through all axis containers:\n  QHashIterator<QCPAxis::AxisType, QList<QCPAxis*> > it(mAxes);\n  while (it.hasNext())\n  {\n    it.next();\n    if (it.value().contains(axis))\n    {\n      mAxes[it.key()].removeOne(axis);\n      if (qobject_cast<QCustomPlot*>(parentPlot())) // make sure this isn't called from QObject dtor when QCustomPlot is already destructed (happens when the axis rect is not in any layout and thus QObject-child of QCustomPlot)\n        parentPlot()->axisRemoved(axis);\n      delete axis;\n      return true;\n    }\n  }\n  qDebug() << Q_FUNC_INFO << \"Axis isn't in axis rect:\" << reinterpret_cast<quintptr>(axis);\n  return false;\n}\n\n/*!\n  Convenience function to create an axis on each side that doesn't have any axes yet and set their\n  visibility to true. Further, the top/right axes are assigned the following properties of the\n  bottom/left axes:\n  \n  \\li range (\\ref QCPAxis::setRange)\n  \\li range reversed (\\ref QCPAxis::setRangeReversed)\n  \\li scale type (\\ref QCPAxis::setScaleType)\n  \\li scale log base  (\\ref QCPAxis::setScaleLogBase)\n  \\li ticks (\\ref QCPAxis::setTicks)\n  \\li auto (major) tick count (\\ref QCPAxis::setAutoTickCount)\n  \\li sub tick count (\\ref QCPAxis::setSubTickCount)\n  \\li auto sub ticks (\\ref QCPAxis::setAutoSubTicks)\n  \\li tick step (\\ref QCPAxis::setTickStep)\n  \\li auto tick step (\\ref QCPAxis::setAutoTickStep)\n  \\li number format (\\ref QCPAxis::setNumberFormat)\n  \\li number precision (\\ref QCPAxis::setNumberPrecision)\n  \\li tick label type (\\ref QCPAxis::setTickLabelType)\n  \\li date time format (\\ref QCPAxis::setDateTimeFormat)\n  \\li date time spec (\\ref QCPAxis::setDateTimeSpec)\n  \n  Tick labels (\\ref QCPAxis::setTickLabels) of the right and top axes are set to false.\n\n  If \\a connectRanges is true, the \\ref QCPAxis::rangeChanged \"rangeChanged\" signals of the bottom\n  and left axes are connected to the \\ref QCPAxis::setRange slots of the top and right axes.\n*/\nvoid QCPAxisRect::setupFullAxesBox(bool connectRanges)\n{\n  QCPAxis *xAxis, *yAxis, *xAxis2, *yAxis2;\n  if (axisCount(QCPAxis::atBottom) == 0)\n    xAxis = addAxis(QCPAxis::atBottom);\n  else\n    xAxis = axis(QCPAxis::atBottom);\n  \n  if (axisCount(QCPAxis::atLeft) == 0)\n    yAxis = addAxis(QCPAxis::atLeft);\n  else\n    yAxis = axis(QCPAxis::atLeft);\n  \n  if (axisCount(QCPAxis::atTop) == 0)\n    xAxis2 = addAxis(QCPAxis::atTop);\n  else\n    xAxis2 = axis(QCPAxis::atTop);\n  \n  if (axisCount(QCPAxis::atRight) == 0)\n    yAxis2 = addAxis(QCPAxis::atRight);\n  else\n    yAxis2 = axis(QCPAxis::atRight);\n  \n  xAxis->setVisible(true);\n  yAxis->setVisible(true);\n  xAxis2->setVisible(true);\n  yAxis2->setVisible(true);\n  xAxis2->setTickLabels(false);\n  yAxis2->setTickLabels(false);\n  \n  xAxis2->setRange(xAxis->range());\n  xAxis2->setRangeReversed(xAxis->rangeReversed());\n  xAxis2->setScaleType(xAxis->scaleType());\n  xAxis2->setScaleLogBase(xAxis->scaleLogBase());\n  xAxis2->setTicks(xAxis->ticks());\n  xAxis2->setAutoTickCount(xAxis->autoTickCount());\n  xAxis2->setSubTickCount(xAxis->subTickCount());\n  xAxis2->setAutoSubTicks(xAxis->autoSubTicks());\n  xAxis2->setTickStep(xAxis->tickStep());\n  xAxis2->setAutoTickStep(xAxis->autoTickStep());\n  xAxis2->setNumberFormat(xAxis->numberFormat());\n  xAxis2->setNumberPrecision(xAxis->numberPrecision());\n  xAxis2->setTickLabelType(xAxis->tickLabelType());\n  xAxis2->setDateTimeFormat(xAxis->dateTimeFormat());\n  xAxis2->setDateTimeSpec(xAxis->dateTimeSpec());\n\n  yAxis2->setRange(yAxis->range());\n  yAxis2->setRangeReversed(yAxis->rangeReversed());\n  yAxis2->setScaleType(yAxis->scaleType());\n  yAxis2->setScaleLogBase(yAxis->scaleLogBase());\n  yAxis2->setTicks(yAxis->ticks());\n  yAxis2->setAutoTickCount(yAxis->autoTickCount());\n  yAxis2->setSubTickCount(yAxis->subTickCount());\n  yAxis2->setAutoSubTicks(yAxis->autoSubTicks());\n  yAxis2->setTickStep(yAxis->tickStep());\n  yAxis2->setAutoTickStep(yAxis->autoTickStep());\n  yAxis2->setNumberFormat(yAxis->numberFormat());\n  yAxis2->setNumberPrecision(yAxis->numberPrecision());\n  yAxis2->setTickLabelType(yAxis->tickLabelType());\n  yAxis2->setDateTimeFormat(yAxis->dateTimeFormat());\n  yAxis2->setDateTimeSpec(yAxis->dateTimeSpec());\n  \n  if (connectRanges)\n  {\n    connect(xAxis, SIGNAL(rangeChanged(QCPRange)), xAxis2, SLOT(setRange(QCPRange)));\n    connect(yAxis, SIGNAL(rangeChanged(QCPRange)), yAxis2, SLOT(setRange(QCPRange)));\n  }\n}\n\n/*!\n  Returns a list of all the plottables that are associated with this axis rect.\n  \n  A plottable is considered associated with an axis rect if its key or value axis (or both) is in\n  this axis rect.\n  \n  \\see graphs, items\n*/\nQList<QCPAbstractPlottable*> QCPAxisRect::plottables() const\n{\n  // Note: don't append all QCPAxis::plottables() into a list, because we might get duplicate entries\n  QList<QCPAbstractPlottable*> result;\n  for (int i=0; i<mParentPlot->mPlottables.size(); ++i)\n  {\n    if (mParentPlot->mPlottables.at(i)->keyAxis()->axisRect() == this ||mParentPlot->mPlottables.at(i)->valueAxis()->axisRect() == this)\n      result.append(mParentPlot->mPlottables.at(i));\n  }\n  return result;\n}\n\n/*!\n  Returns a list of all the graphs that are associated with this axis rect.\n  \n  A graph is considered associated with an axis rect if its key or value axis (or both) is in\n  this axis rect.\n  \n  \\see plottables, items\n*/\nQList<QCPGraph*> QCPAxisRect::graphs() const\n{\n  // Note: don't append all QCPAxis::graphs() into a list, because we might get duplicate entries\n  QList<QCPGraph*> result;\n  for (int i=0; i<mParentPlot->mGraphs.size(); ++i)\n  {\n    if (mParentPlot->mGraphs.at(i)->keyAxis()->axisRect() == this || mParentPlot->mGraphs.at(i)->valueAxis()->axisRect() == this)\n      result.append(mParentPlot->mGraphs.at(i));\n  }\n  return result;\n}\n\n/*!\n  Returns a list of all the items that are associated with this axis rect.\n  \n  An item is considered associated with an axis rect if any of its positions has key or value axis\n  set to an axis that is in this axis rect, or if any of its positions has \\ref\n  QCPItemPosition::setAxisRect set to the axis rect, or if the clip axis rect (\\ref\n  QCPAbstractItem::setClipAxisRect) is set to this axis rect.\n  \n  \\see plottables, graphs\n*/\nQList<QCPAbstractItem *> QCPAxisRect::items() const\n{\n  // Note: don't just append all QCPAxis::items() into a list, because we might get duplicate entries\n  //       and miss those items that have this axis rect as clipAxisRect.\n  QList<QCPAbstractItem*> result;\n  for (int itemId=0; itemId<mParentPlot->mItems.size(); ++itemId)\n  {\n    if (mParentPlot->mItems.at(itemId)->clipAxisRect() == this)\n    {\n      result.append(mParentPlot->mItems.at(itemId));\n      continue;\n    }\n    QList<QCPItemPosition*> positions = mParentPlot->mItems.at(itemId)->positions();\n    for (int posId=0; posId<positions.size(); ++posId)\n    {\n      if (positions.at(posId)->axisRect() == this ||\n          positions.at(posId)->keyAxis()->axisRect() == this ||\n          positions.at(posId)->valueAxis()->axisRect() == this)\n      {\n        result.append(mParentPlot->mItems.at(itemId));\n        break;\n      }\n    }\n  }\n  return result;\n}\n\n/*!\n  This method is called automatically upon replot and doesn't need to be called by users of\n  QCPAxisRect.\n  \n  Calls the base class implementation to update the margins (see \\ref QCPLayoutElement::update),\n  and finally passes the \\ref rect to the inset layout (\\ref insetLayout) and calls its\n  QCPInsetLayout::update function.\n*/\nvoid QCPAxisRect::update(UpdatePhase phase)\n{\n  QCPLayoutElement::update(phase);\n  \n  switch (phase)\n  {\n    case upPreparation:\n    {\n      QList<QCPAxis*> allAxes = axes();\n      for (int i=0; i<allAxes.size(); ++i)\n        allAxes.at(i)->setupTickVectors();\n      break;\n    }\n    case upLayout:\n    {\n      mInsetLayout->setOuterRect(rect());\n      break;\n    }\n    default: break;\n  }\n  \n  // pass update call on to inset layout (doesn't happen automatically, because QCPAxisRect doesn't derive from QCPLayout):\n  mInsetLayout->update(phase);\n}\n\n/* inherits documentation from base class */\nQList<QCPLayoutElement*> QCPAxisRect::elements(bool recursive) const\n{\n  QList<QCPLayoutElement*> result;\n  if (mInsetLayout)\n  {\n    result << mInsetLayout;\n    if (recursive)\n      result << mInsetLayout->elements(recursive);\n  }\n  return result;\n}\n\n/* inherits documentation from base class */\nvoid QCPAxisRect::applyDefaultAntialiasingHint(QCPPainter *painter) const\n{\n  painter->setAntialiasing(false);\n}\n\n/* inherits documentation from base class */\nvoid QCPAxisRect::draw(QCPPainter *painter)\n{\n  drawBackground(painter);\n}\n\n/*!\n  Sets \\a pm as the axis background pixmap. The axis background pixmap will be drawn inside the\n  axis rect. Since axis rects place themselves on the \"background\" layer by default, the axis rect\n  backgrounds are usually drawn below everything else.\n\n  For cases where the provided pixmap doesn't have the same size as the axis rect, scaling can be\n  enabled with \\ref setBackgroundScaled and the scaling mode (i.e. whether and how the aspect ratio\n  is preserved) can be set with \\ref setBackgroundScaledMode. To set all these options in one call,\n  consider using the overloaded version of this function.\n\n  Below the pixmap, the axis rect may be optionally filled with a brush, if specified with \\ref\n  setBackground(const QBrush &brush).\n  \n  \\see setBackgroundScaled, setBackgroundScaledMode, setBackground(const QBrush &brush)\n*/\nvoid QCPAxisRect::setBackground(const QPixmap &pm)\n{\n  mBackgroundPixmap = pm;\n  mScaledBackgroundPixmap = QPixmap();\n}\n\n/*! \\overload\n  \n  Sets \\a brush as the background brush. The axis rect background will be filled with this brush.\n  Since axis rects place themselves on the \"background\" layer by default, the axis rect backgrounds\n  are usually drawn below everything else.\n\n  The brush will be drawn before (under) any background pixmap, which may be specified with \\ref\n  setBackground(const QPixmap &pm).\n\n  To disable drawing of a background brush, set \\a brush to Qt::NoBrush.\n  \n  \\see setBackground(const QPixmap &pm)\n*/\nvoid QCPAxisRect::setBackground(const QBrush &brush)\n{\n  mBackgroundBrush = brush;\n}\n\n/*! \\overload\n  \n  Allows setting the background pixmap of the axis rect, whether it shall be scaled and how it\n  shall be scaled in one call.\n\n  \\see setBackground(const QPixmap &pm), setBackgroundScaled, setBackgroundScaledMode\n*/\nvoid QCPAxisRect::setBackground(const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode)\n{\n  mBackgroundPixmap = pm;\n  mScaledBackgroundPixmap = QPixmap();\n  mBackgroundScaled = scaled;\n  mBackgroundScaledMode = mode;\n}\n\n/*!\n  Sets whether the axis background pixmap shall be scaled to fit the axis rect or not. If \\a scaled\n  is set to true, you may control whether and how the aspect ratio of the original pixmap is\n  preserved with \\ref setBackgroundScaledMode.\n  \n  Note that the scaled version of the original pixmap is buffered, so there is no performance\n  penalty on replots. (Except when the axis rect dimensions are changed continuously.)\n  \n  \\see setBackground, setBackgroundScaledMode\n*/\nvoid QCPAxisRect::setBackgroundScaled(bool scaled)\n{\n  mBackgroundScaled = scaled;\n}\n\n/*!\n  If scaling of the axis background pixmap is enabled (\\ref setBackgroundScaled), use this function to\n  define whether and how the aspect ratio of the original pixmap passed to \\ref setBackground is preserved.\n  \\see setBackground, setBackgroundScaled\n*/\nvoid QCPAxisRect::setBackgroundScaledMode(Qt::AspectRatioMode mode)\n{\n  mBackgroundScaledMode = mode;\n}\n\n/*!\n  Returns the range drag axis of the \\a orientation provided.\n  \n  \\see setRangeDragAxes\n*/\nQCPAxis *QCPAxisRect::rangeDragAxis(Qt::Orientation orientation)\n{\n  return (orientation == Qt::Horizontal ? mRangeDragHorzAxis.data() : mRangeDragVertAxis.data());\n}\n\n/*!\n  Returns the range zoom axis of the \\a orientation provided.\n  \n  \\see setRangeZoomAxes\n*/\nQCPAxis *QCPAxisRect::rangeZoomAxis(Qt::Orientation orientation)\n{\n  return (orientation == Qt::Horizontal ? mRangeZoomHorzAxis.data() : mRangeZoomVertAxis.data());\n}\n\n/*!\n  Returns the range zoom factor of the \\a orientation provided.\n  \n  \\see setRangeZoomFactor\n*/\ndouble QCPAxisRect::rangeZoomFactor(Qt::Orientation orientation)\n{\n  return (orientation == Qt::Horizontal ? mRangeZoomFactorHorz : mRangeZoomFactorVert);\n}\n\n/*!\n  Sets which axis orientation may be range dragged by the user with mouse interaction.\n  What orientation corresponds to which specific axis can be set with\n  \\ref setRangeDragAxes(QCPAxis *horizontal, QCPAxis *vertical). By\n  default, the horizontal axis is the bottom axis (xAxis) and the vertical axis\n  is the left axis (yAxis).\n  \n  To disable range dragging entirely, pass 0 as \\a orientations or remove \\ref QCP::iRangeDrag from \\ref\n  QCustomPlot::setInteractions. To enable range dragging for both directions, pass <tt>Qt::Horizontal |\n  Qt::Vertical</tt> as \\a orientations.\n  \n  In addition to setting \\a orientations to a non-zero value, make sure \\ref QCustomPlot::setInteractions\n  contains \\ref QCP::iRangeDrag to enable the range dragging interaction.\n  \n  \\see setRangeZoom, setRangeDragAxes, setNoAntialiasingOnDrag\n*/\nvoid QCPAxisRect::setRangeDrag(Qt::Orientations orientations)\n{\n  mRangeDrag = orientations;\n}\n\n/*!\n  Sets which axis orientation may be zoomed by the user with the mouse wheel. What orientation\n  corresponds to which specific axis can be set with \\ref setRangeZoomAxes(QCPAxis *horizontal,\n  QCPAxis *vertical). By default, the horizontal axis is the bottom axis (xAxis) and the vertical\n  axis is the left axis (yAxis).\n\n  To disable range zooming entirely, pass 0 as \\a orientations or remove \\ref QCP::iRangeZoom from \\ref\n  QCustomPlot::setInteractions. To enable range zooming for both directions, pass <tt>Qt::Horizontal |\n  Qt::Vertical</tt> as \\a orientations.\n  \n  In addition to setting \\a orientations to a non-zero value, make sure \\ref QCustomPlot::setInteractions\n  contains \\ref QCP::iRangeZoom to enable the range zooming interaction.\n  \n  \\see setRangeZoomFactor, setRangeZoomAxes, setRangeDrag\n*/\nvoid QCPAxisRect::setRangeZoom(Qt::Orientations orientations)\n{\n  mRangeZoom = orientations;\n}\n\n/*!\n  Sets the axes whose range will be dragged when \\ref setRangeDrag enables mouse range dragging\n  on the QCustomPlot widget.\n  \n  \\see setRangeZoomAxes\n*/\nvoid QCPAxisRect::setRangeDragAxes(QCPAxis *horizontal, QCPAxis *vertical)\n{\n  mRangeDragHorzAxis = horizontal;\n  mRangeDragVertAxis = vertical;\n}\n\n/*!\n  Sets the axes whose range will be zoomed when \\ref setRangeZoom enables mouse wheel zooming on the\n  QCustomPlot widget. The two axes can be zoomed with different strengths, when different factors\n  are passed to \\ref setRangeZoomFactor(double horizontalFactor, double verticalFactor).\n  \n  \\see setRangeDragAxes\n*/\nvoid QCPAxisRect::setRangeZoomAxes(QCPAxis *horizontal, QCPAxis *vertical)\n{\n  mRangeZoomHorzAxis = horizontal;\n  mRangeZoomVertAxis = vertical;\n}\n\n/*!\n  Sets how strong one rotation step of the mouse wheel zooms, when range zoom was activated with\n  \\ref setRangeZoom. The two parameters \\a horizontalFactor and \\a verticalFactor provide a way to\n  let the horizontal axis zoom at different rates than the vertical axis. Which axis is horizontal\n  and which is vertical, can be set with \\ref setRangeZoomAxes.\n\n  When the zoom factor is greater than one, scrolling the mouse wheel backwards (towards the user)\n  will zoom in (make the currently visible range smaller). For zoom factors smaller than one, the\n  same scrolling direction will zoom out.\n*/\nvoid QCPAxisRect::setRangeZoomFactor(double horizontalFactor, double verticalFactor)\n{\n  mRangeZoomFactorHorz = horizontalFactor;\n  mRangeZoomFactorVert = verticalFactor;\n}\n\n/*! \\overload\n  \n  Sets both the horizontal and vertical zoom \\a factor.\n*/\nvoid QCPAxisRect::setRangeZoomFactor(double factor)\n{\n  mRangeZoomFactorHorz = factor;\n  mRangeZoomFactorVert = factor;\n}\n\n/*! \\internal\n  \n  Draws the background of this axis rect. It may consist of a background fill (a QBrush) and a\n  pixmap.\n  \n  If a brush was given via \\ref setBackground(const QBrush &brush), this function first draws an\n  according filling inside the axis rect with the provided \\a painter.\n  \n  Then, if a pixmap was provided via \\ref setBackground, this function buffers the scaled version\n  depending on \\ref setBackgroundScaled and \\ref setBackgroundScaledMode and then draws it inside\n  the axis rect with the provided \\a painter. The scaled version is buffered in\n  mScaledBackgroundPixmap to prevent expensive rescaling at every redraw. It is only updated, when\n  the axis rect has changed in a way that requires a rescale of the background pixmap (this is\n  dependant on the \\ref setBackgroundScaledMode), or when a differend axis backgroud pixmap was\n  set.\n  \n  \\see setBackground, setBackgroundScaled, setBackgroundScaledMode\n*/\nvoid QCPAxisRect::drawBackground(QCPPainter *painter)\n{\n  // draw background fill:\n  if (mBackgroundBrush != Qt::NoBrush)\n    painter->fillRect(mRect, mBackgroundBrush);\n  \n  // draw background pixmap (on top of fill, if brush specified):\n  if (!mBackgroundPixmap.isNull())\n  {\n    if (mBackgroundScaled)\n    {\n      // check whether mScaledBackground needs to be updated:\n      QSize scaledSize(mBackgroundPixmap.size());\n      scaledSize.scale(mRect.size(), mBackgroundScaledMode);\n      if (mScaledBackgroundPixmap.size() != scaledSize)\n        mScaledBackgroundPixmap = mBackgroundPixmap.scaled(mRect.size(), mBackgroundScaledMode, Qt::SmoothTransformation);\n      painter->drawPixmap(mRect.topLeft(), mScaledBackgroundPixmap, QRect(0, 0, mRect.width(), mRect.height()) & mScaledBackgroundPixmap.rect());\n    } else\n    {\n      painter->drawPixmap(mRect.topLeft(), mBackgroundPixmap, QRect(0, 0, mRect.width(), mRect.height()));\n    }\n  }\n}\n\n/*! \\internal\n  \n  This function makes sure multiple axes on the side specified with \\a type don't collide, but are\n  distributed according to their respective space requirement (QCPAxis::calculateMargin).\n  \n  It does this by setting an appropriate offset (\\ref QCPAxis::setOffset) on all axes except the\n  one with index zero.\n  \n  This function is called by \\ref calculateAutoMargin.\n*/\nvoid QCPAxisRect::updateAxesOffset(QCPAxis::AxisType type)\n{\n  const QList<QCPAxis*> axesList = mAxes.value(type);\n  if (axesList.isEmpty())\n    return;\n  \n  bool isFirstVisible = !axesList.first()->visible(); // if the first axis is visible, the second axis (which is where the loop starts) isn't the first visible axis, so initialize with false\n  for (int i=1; i<axesList.size(); ++i)\n  {\n    int offset = axesList.at(i-1)->offset() + axesList.at(i-1)->calculateMargin();\n    if (axesList.at(i)->visible()) // only add inner tick length to offset if this axis is visible and it's not the first visible one (might happen if true first axis is invisible)\n    {\n      if (!isFirstVisible)\n        offset += axesList.at(i)->tickLengthIn();\n      isFirstVisible = false;\n    }\n    axesList.at(i)->setOffset(offset);\n  }\n}\n\n/* inherits documentation from base class */\nint QCPAxisRect::calculateAutoMargin(QCP::MarginSide side)\n{\n  if (!mAutoMargins.testFlag(side))\n    qDebug() << Q_FUNC_INFO << \"Called with side that isn't specified as auto margin\";\n  \n  updateAxesOffset(QCPAxis::marginSideToAxisType(side));\n  \n  // note: only need to look at the last (outer most) axis to determine the total margin, due to updateAxisOffset call\n  const QList<QCPAxis*> axesList = mAxes.value(QCPAxis::marginSideToAxisType(side));\n  if (axesList.size() > 0)\n    return axesList.last()->offset() + axesList.last()->calculateMargin();\n  else\n    return 0;\n}\n\n/*! \\internal\n  \n  Event handler for when a mouse button is pressed on the axis rect. If the left mouse button is\n  pressed, the range dragging interaction is initialized (the actual range manipulation happens in\n  the \\ref mouseMoveEvent).\n\n  The mDragging flag is set to true and some anchor points are set that are needed to determine the\n  distance the mouse was dragged in the mouse move/release events later.\n  \n  \\see mouseMoveEvent, mouseReleaseEvent\n*/\nvoid QCPAxisRect::mousePressEvent(QMouseEvent *event)\n{\n  mDragStart = event->pos(); // need this even when not LeftButton is pressed, to determine in releaseEvent whether it was a full click (no position change between press and release)\n  if (event->buttons() & Qt::LeftButton)\n  {\n    mDragging = true;\n    // initialize antialiasing backup in case we start dragging:\n    if (mParentPlot->noAntialiasingOnDrag())\n    {\n      mAADragBackup = mParentPlot->antialiasedElements();\n      mNotAADragBackup = mParentPlot->notAntialiasedElements();\n    }\n    // Mouse range dragging interaction:\n    if (mParentPlot->interactions().testFlag(QCP::iRangeDrag))\n    {\n      if (mRangeDragHorzAxis)\n        mDragStartHorzRange = mRangeDragHorzAxis.data()->range();\n      if (mRangeDragVertAxis)\n        mDragStartVertRange = mRangeDragVertAxis.data()->range();\n    }\n  }\n}\n\n/*! \\internal\n  \n  Event handler for when the mouse is moved on the axis rect. If range dragging was activated in a\n  preceding \\ref mousePressEvent, the range is moved accordingly.\n  \n  \\see mousePressEvent, mouseReleaseEvent\n*/\nvoid QCPAxisRect::mouseMoveEvent(QMouseEvent *event)\n{\n  // Mouse range dragging interaction:\n  if (mDragging && mParentPlot->interactions().testFlag(QCP::iRangeDrag))\n  {\n    if (mRangeDrag.testFlag(Qt::Horizontal))\n    {\n      if (QCPAxis *rangeDragHorzAxis = mRangeDragHorzAxis.data())\n      {\n        if (rangeDragHorzAxis->mScaleType == QCPAxis::stLinear)\n        {\n          double diff = rangeDragHorzAxis->pixelToCoord(mDragStart.x()) - rangeDragHorzAxis->pixelToCoord(event->pos().x());\n          rangeDragHorzAxis->setRange(mDragStartHorzRange.lower+diff, mDragStartHorzRange.upper+diff);\n        } else if (rangeDragHorzAxis->mScaleType == QCPAxis::stLogarithmic)\n        {\n          double diff = rangeDragHorzAxis->pixelToCoord(mDragStart.x()) / rangeDragHorzAxis->pixelToCoord(event->pos().x());\n          rangeDragHorzAxis->setRange(mDragStartHorzRange.lower*diff, mDragStartHorzRange.upper*diff);\n        }\n      }\n    }\n    if (mRangeDrag.testFlag(Qt::Vertical))\n    {\n      if (QCPAxis *rangeDragVertAxis = mRangeDragVertAxis.data())\n      {\n        if (rangeDragVertAxis->mScaleType == QCPAxis::stLinear)\n        {\n          double diff = rangeDragVertAxis->pixelToCoord(mDragStart.y()) - rangeDragVertAxis->pixelToCoord(event->pos().y());\n          rangeDragVertAxis->setRange(mDragStartVertRange.lower+diff, mDragStartVertRange.upper+diff);\n        } else if (rangeDragVertAxis->mScaleType == QCPAxis::stLogarithmic)\n        {\n          double diff = rangeDragVertAxis->pixelToCoord(mDragStart.y()) / rangeDragVertAxis->pixelToCoord(event->pos().y());\n          rangeDragVertAxis->setRange(mDragStartVertRange.lower*diff, mDragStartVertRange.upper*diff);\n        }\n      }\n    }\n    if (mRangeDrag != 0) // if either vertical or horizontal drag was enabled, do a replot\n    {\n      if (mParentPlot->noAntialiasingOnDrag())\n        mParentPlot->setNotAntialiasedElements(QCP::aeAll);\n      mParentPlot->replot();\n    }\n  }\n}\n\n/* inherits documentation from base class */\nvoid QCPAxisRect::mouseReleaseEvent(QMouseEvent *event)\n{\n  Q_UNUSED(event)\n  mDragging = false;\n  if (mParentPlot->noAntialiasingOnDrag())\n  {\n    mParentPlot->setAntialiasedElements(mAADragBackup);\n    mParentPlot->setNotAntialiasedElements(mNotAADragBackup);\n  }\n}\n\n/*! \\internal\n  \n  Event handler for mouse wheel events. If rangeZoom is Qt::Horizontal, Qt::Vertical or both, the\n  ranges of the axes defined as rangeZoomHorzAxis and rangeZoomVertAxis are scaled. The center of\n  the scaling operation is the current cursor position inside the axis rect. The scaling factor is\n  dependant on the mouse wheel delta (which direction the wheel was rotated) to provide a natural\n  zooming feel. The Strength of the zoom can be controlled via \\ref setRangeZoomFactor.\n  \n  Note, that event->delta() is usually +/-120 for single rotation steps. However, if the mouse\n  wheel is turned rapidly, many steps may bunch up to one event, so the event->delta() may then be\n  multiples of 120. This is taken into account here, by calculating \\a wheelSteps and using it as\n  exponent of the range zoom factor. This takes care of the wheel direction automatically, by\n  inverting the factor, when the wheel step is negative (f^-1 = 1/f).\n*/\nvoid QCPAxisRect::wheelEvent(QWheelEvent *event)\n{\n  // Mouse range zooming interaction:\n  if (mParentPlot->interactions().testFlag(QCP::iRangeZoom))\n  {\n    if (mRangeZoom != 0)\n    {\n      double factor;\n      double wheelSteps = event->delta()/120.0; // a single step delta is +/-120 usually\n      if (mRangeZoom.testFlag(Qt::Horizontal))\n      {\n        factor = pow(mRangeZoomFactorHorz, wheelSteps);\n        if (mRangeZoomHorzAxis.data())\n          mRangeZoomHorzAxis.data()->scaleRange(factor, mRangeZoomHorzAxis.data()->pixelToCoord(event->pos().x()));\n      }\n      if (mRangeZoom.testFlag(Qt::Vertical))\n      {\n        factor = pow(mRangeZoomFactorVert, wheelSteps);\n        if (mRangeZoomVertAxis.data())\n          mRangeZoomVertAxis.data()->scaleRange(factor, mRangeZoomVertAxis.data()->pixelToCoord(event->pos().y()));\n      }\n      mParentPlot->replot();\n    }\n  }\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPAbstractLegendItem\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPAbstractLegendItem\n  \\brief The abstract base class for all entries in a QCPLegend.\n  \n  It defines a very basic interface for entries in a QCPLegend. For representing plottables in the\n  legend, the subclass \\ref QCPPlottableLegendItem is more suitable.\n  \n  Only derive directly from this class when you need absolute freedom (e.g. a custom legend entry\n  that's not even associated with a plottable).\n\n  You must implement the following pure virtual functions:\n  \\li \\ref draw (from QCPLayerable)\n  \n  You inherit the following members you may use:\n  <table>\n    <tr>\n      <td>QCPLegend *\\b mParentLegend</td>\n      <td>A pointer to the parent QCPLegend.</td>\n    </tr><tr>\n      <td>QFont \\b mFont</td>\n      <td>The generic font of the item. You should use this font for all or at least the most prominent text of the item.</td>\n    </tr>\n  </table>\n*/\n\n/* start of documentation of signals */\n\n/*! \\fn void QCPAbstractLegendItem::selectionChanged(bool selected)\n  \n  This signal is emitted when the selection state of this legend item has changed, either by user\n  interaction or by a direct call to \\ref setSelected.\n*/\n\n/* end of documentation of signals */\n\n/*!\n  Constructs a QCPAbstractLegendItem and associates it with the QCPLegend \\a parent. This does not\n  cause the item to be added to \\a parent, so \\ref QCPLegend::addItem must be called separately.\n*/\nQCPAbstractLegendItem::QCPAbstractLegendItem(QCPLegend *parent) :\n  QCPLayoutElement(parent->parentPlot()),\n  mParentLegend(parent),\n  mFont(parent->font()),\n  mTextColor(parent->textColor()),\n  mSelectedFont(parent->selectedFont()),\n  mSelectedTextColor(parent->selectedTextColor()),\n  mSelectable(true),\n  mSelected(false)\n{\n  setLayer(\"legend\");\n  setMargins(QMargins(8, 2, 8, 2));\n}\n\n/*!\n  Sets the default font of this specific legend item to \\a font.\n  \n  \\see setTextColor, QCPLegend::setFont\n*/\nvoid QCPAbstractLegendItem::setFont(const QFont &font)\n{\n  mFont = font;\n}\n\n/*!\n  Sets the default text color of this specific legend item to \\a color.\n  \n  \\see setFont, QCPLegend::setTextColor\n*/\nvoid QCPAbstractLegendItem::setTextColor(const QColor &color)\n{\n  mTextColor = color;\n}\n\n/*!\n  When this legend item is selected, \\a font is used to draw generic text, instead of the normal\n  font set with \\ref setFont.\n  \n  \\see setFont, QCPLegend::setSelectedFont\n*/\nvoid QCPAbstractLegendItem::setSelectedFont(const QFont &font)\n{\n  mSelectedFont = font;\n}\n\n/*!\n  When this legend item is selected, \\a color is used to draw generic text, instead of the normal\n  color set with \\ref setTextColor.\n  \n  \\see setTextColor, QCPLegend::setSelectedTextColor\n*/\nvoid QCPAbstractLegendItem::setSelectedTextColor(const QColor &color)\n{\n  mSelectedTextColor = color;\n}\n\n/*!\n  Sets whether this specific legend item is selectable.\n  \n  \\see setSelectedParts, QCustomPlot::setInteractions\n*/\nvoid QCPAbstractLegendItem::setSelectable(bool selectable)\n{\n  if (mSelectable != selectable)\n  {\n    mSelectable = selectable;\n    emit selectableChanged(mSelectable);\n  }\n}\n\n/*!\n  Sets whether this specific legend item is selected.\n  \n  It is possible to set the selection state of this item by calling this function directly, even if\n  setSelectable is set to false.\n  \n  \\see setSelectableParts, QCustomPlot::setInteractions\n*/\nvoid QCPAbstractLegendItem::setSelected(bool selected)\n{\n  if (mSelected != selected)\n  {\n    mSelected = selected;\n    emit selectionChanged(mSelected);\n  }\n}\n\n/* inherits documentation from base class */\ndouble QCPAbstractLegendItem::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const\n{\n  Q_UNUSED(details)\n  if (!mParentPlot) return -1;\n  if (onlySelectable && (!mSelectable || !mParentLegend->selectableParts().testFlag(QCPLegend::spItems)))\n    return -1;\n  \n  if (mRect.contains(pos.toPoint()))\n    return mParentPlot->selectionTolerance()*0.99;\n  else\n    return -1;\n}\n\n/* inherits documentation from base class */\nvoid QCPAbstractLegendItem::applyDefaultAntialiasingHint(QCPPainter *painter) const\n{\n  applyAntialiasingHint(painter, mAntialiased, QCP::aeLegendItems);\n}\n\n/* inherits documentation from base class */\nQRect QCPAbstractLegendItem::clipRect() const\n{\n  return mOuterRect;\n}\n\n/* inherits documentation from base class */\nvoid QCPAbstractLegendItem::selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)\n{\n  Q_UNUSED(event)\n  Q_UNUSED(details)\n  if (mSelectable && mParentLegend->selectableParts().testFlag(QCPLegend::spItems))\n  {\n    bool selBefore = mSelected;\n    setSelected(additive ? !mSelected : true);\n    if (selectionStateChanged)\n      *selectionStateChanged = mSelected != selBefore;\n  }\n}\n\n/* inherits documentation from base class */\nvoid QCPAbstractLegendItem::deselectEvent(bool *selectionStateChanged)\n{\n  if (mSelectable && mParentLegend->selectableParts().testFlag(QCPLegend::spItems))\n  {\n    bool selBefore = mSelected;\n    setSelected(false);\n    if (selectionStateChanged)\n      *selectionStateChanged = mSelected != selBefore;\n  }\n}\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPPlottableLegendItem\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPPlottableLegendItem\n  \\brief A legend item representing a plottable with an icon and the plottable name.\n  \n  This is the standard legend item for plottables. It displays an icon of the plottable next to the\n  plottable name. The icon is drawn by the respective plottable itself (\\ref\n  QCPAbstractPlottable::drawLegendIcon), and tries to give an intuitive symbol for the plottable.\n  For example, the QCPGraph draws a centered horizontal line and/or a single scatter point in the\n  middle.\n  \n  Legend items of this type are always associated with one plottable (retrievable via the\n  plottable() function and settable with the constructor). You may change the font of the plottable\n  name with \\ref setFont. Icon padding and border pen is taken from the parent QCPLegend, see \\ref\n  QCPLegend::setIconBorderPen and \\ref QCPLegend::setIconTextPadding.\n\n  The function \\ref QCPAbstractPlottable::addToLegend/\\ref QCPAbstractPlottable::removeFromLegend\n  creates/removes legend items of this type in the default implementation. However, these functions\n  may be reimplemented such that a different kind of legend item (e.g a direct subclass of\n  QCPAbstractLegendItem) is used for that plottable.\n  \n  Since QCPLegend is based on QCPLayoutGrid, a legend item itself is just a subclass of\n  QCPLayoutElement. While it could be added to a legend (or any other layout) via the normal layout\n  interface, QCPLegend has specialized functions for handling legend items conveniently, see the\n  documentation of \\ref QCPLegend.\n*/\n\n/*!\n  Creates a new legend item associated with \\a plottable.\n  \n  Once it's created, it can be added to the legend via \\ref QCPLegend::addItem.\n  \n  A more convenient way of adding/removing a plottable to/from the legend is via the functions \\ref\n  QCPAbstractPlottable::addToLegend and \\ref QCPAbstractPlottable::removeFromLegend.\n*/\nQCPPlottableLegendItem::QCPPlottableLegendItem(QCPLegend *parent, QCPAbstractPlottable *plottable) :\n  QCPAbstractLegendItem(parent),\n  mPlottable(plottable)\n{\n}\n\n/*! \\internal\n  \n  Returns the pen that shall be used to draw the icon border, taking into account the selection\n  state of this item.\n*/\nQPen QCPPlottableLegendItem::getIconBorderPen() const\n{\n  return mSelected ? mParentLegend->selectedIconBorderPen() : mParentLegend->iconBorderPen();\n}\n\n/*! \\internal\n  \n  Returns the text color that shall be used to draw text, taking into account the selection state\n  of this item.\n*/\nQColor QCPPlottableLegendItem::getTextColor() const\n{\n  return mSelected ? mSelectedTextColor : mTextColor;\n}\n\n/*! \\internal\n  \n  Returns the font that shall be used to draw text, taking into account the selection state of this\n  item.\n*/\nQFont QCPPlottableLegendItem::getFont() const\n{\n  return mSelected ? mSelectedFont : mFont;\n}\n\n/*! \\internal\n  \n  Draws the item with \\a painter. The size and position of the drawn legend item is defined by the\n  parent layout (typically a \\ref QCPLegend) and the \\ref minimumSizeHint and \\ref maximumSizeHint\n  of this legend item.\n*/\nvoid QCPPlottableLegendItem::draw(QCPPainter *painter)\n{\n  if (!mPlottable) return;\n  painter->setFont(getFont());\n  painter->setPen(QPen(getTextColor()));\n  QSizeF iconSize = mParentLegend->iconSize();\n  QRectF textRect = painter->fontMetrics().boundingRect(0, 0, 0, iconSize.height(), Qt::TextDontClip, mPlottable->name());\n  QRectF iconRect(mRect.topLeft(), iconSize);\n  int textHeight = qMax(textRect.height(), iconSize.height());  // if text has smaller height than icon, center text vertically in icon height, else align tops\n  painter->drawText(mRect.x()+iconSize.width()+mParentLegend->iconTextPadding(), mRect.y(), textRect.width(), textHeight, Qt::TextDontClip, mPlottable->name());\n  // draw icon:\n  painter->save();\n  painter->setClipRect(iconRect, Qt::IntersectClip);\n  mPlottable->drawLegendIcon(painter, iconRect);\n  painter->restore();\n  // draw icon border:\n  if (getIconBorderPen().style() != Qt::NoPen)\n  {\n    painter->setPen(getIconBorderPen());\n    painter->setBrush(Qt::NoBrush);\n    painter->drawRect(iconRect);\n  }\n}\n\n/*! \\internal\n  \n  Calculates and returns the size of this item. This includes the icon, the text and the padding in\n  between.\n*/\nQSize QCPPlottableLegendItem::minimumSizeHint() const\n{\n  if (!mPlottable) return QSize();\n  QSize result(0, 0);\n  QRect textRect;\n  QFontMetrics fontMetrics(getFont());\n  QSize iconSize = mParentLegend->iconSize();\n  textRect = fontMetrics.boundingRect(0, 0, 0, iconSize.height(), Qt::TextDontClip, mPlottable->name());\n  result.setWidth(iconSize.width() + mParentLegend->iconTextPadding() + textRect.width() + mMargins.left() + mMargins.right());\n  result.setHeight(qMax(textRect.height(), iconSize.height()) + mMargins.top() + mMargins.bottom());\n  return result;\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPLegend\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPLegend\n  \\brief Manages a legend inside a QCustomPlot.\n\n  A legend is a small box somewhere in the plot which lists plottables with their name and icon.\n  \n  Normally, the legend is populated by calling \\ref QCPAbstractPlottable::addToLegend. The\n  respective legend item can be removed with \\ref QCPAbstractPlottable::removeFromLegend. However,\n  QCPLegend also offers an interface to add and manipulate legend items directly: \\ref item, \\ref\n  itemWithPlottable, \\ref itemCount, \\ref addItem, \\ref removeItem, etc.\n  \n  The QCPLegend derives from QCPLayoutGrid and as such can be placed in any position a\n  QCPLayoutElement may be positioned. The legend items are themselves QCPLayoutElements which are\n  placed in the grid layout of the legend. QCPLegend only adds an interface specialized for\n  handling child elements of type QCPAbstractLegendItem, as mentioned above. In principle, any\n  other layout elements may also be added to a legend via the normal \\ref QCPLayoutGrid interface.\n  However, the QCPAbstractLegendItem-Interface will ignore those elements (e.g. \\ref itemCount will\n  only return the number of items with QCPAbstractLegendItems type).\n\n  By default, every QCustomPlot has one legend (QCustomPlot::legend) which is placed in the inset\n  layout of the main axis rect (\\ref QCPAxisRect::insetLayout). To move the legend to another\n  position inside the axis rect, use the methods of the \\ref QCPLayoutInset. To move the legend\n  outside of the axis rect, place it anywhere else with the QCPLayout/QCPLayoutElement interface.\n*/\n\n/* start of documentation of signals */\n\n/*! \\fn void QCPLegend::selectionChanged(QCPLegend::SelectableParts selection);\n\n  This signal is emitted when the selection state of this legend has changed.\n  \n  \\see setSelectedParts, setSelectableParts\n*/\n\n/* end of documentation of signals */\n\n/*!\n  Constructs a new QCPLegend instance with \\a parentPlot as the containing plot and default values.\n  \n  Note that by default, QCustomPlot already contains a legend ready to be used as\n  QCustomPlot::legend\n*/\nQCPLegend::QCPLegend()\n{\n  setRowSpacing(0);\n  setColumnSpacing(10);\n  setMargins(QMargins(2, 3, 2, 2));\n  setAntialiased(false);\n  setIconSize(32, 18);\n  \n  setIconTextPadding(7);\n  \n  setSelectableParts(spLegendBox | spItems);\n  setSelectedParts(spNone);\n  \n  setBorderPen(QPen(Qt::black));\n  setSelectedBorderPen(QPen(Qt::blue, 2));\n  setIconBorderPen(Qt::NoPen);\n  setSelectedIconBorderPen(QPen(Qt::blue, 2));\n  setBrush(Qt::white);\n  setSelectedBrush(Qt::white);\n  setTextColor(Qt::black);\n  setSelectedTextColor(Qt::blue);\n}\n\nQCPLegend::~QCPLegend()\n{\n  clearItems();\n  if (mParentPlot)\n    mParentPlot->legendRemoved(this);\n}\n\n/* no doc for getter, see setSelectedParts */\nQCPLegend::SelectableParts QCPLegend::selectedParts() const\n{\n  // check whether any legend elements selected, if yes, add spItems to return value\n  bool hasSelectedItems = false;\n  for (int i=0; i<itemCount(); ++i)\n  {\n    if (item(i) && item(i)->selected())\n    {\n      hasSelectedItems = true;\n      break;\n    }\n  }\n  if (hasSelectedItems)\n    return mSelectedParts | spItems;\n  else\n    return mSelectedParts & ~spItems;\n}\n\n/*!\n  Sets the pen, the border of the entire legend is drawn with.\n*/\nvoid QCPLegend::setBorderPen(const QPen &pen)\n{\n  mBorderPen = pen;\n}\n\n/*!\n  Sets the brush of the legend background.\n*/\nvoid QCPLegend::setBrush(const QBrush &brush)\n{\n  mBrush = brush;\n}\n\n/*!\n  Sets the default font of legend text. Legend items that draw text (e.g. the name of a graph) will\n  use this font by default. However, a different font can be specified on a per-item-basis by\n  accessing the specific legend item.\n  \n  This function will also set \\a font on all already existing legend items.\n  \n  \\see QCPAbstractLegendItem::setFont\n*/\nvoid QCPLegend::setFont(const QFont &font)\n{\n  mFont = font;\n  for (int i=0; i<itemCount(); ++i)\n  {\n    if (item(i))\n      item(i)->setFont(mFont);\n  }\n}\n\n/*!\n  Sets the default color of legend text. Legend items that draw text (e.g. the name of a graph)\n  will use this color by default. However, a different colors can be specified on a per-item-basis\n  by accessing the specific legend item.\n  \n  This function will also set \\a color on all already existing legend items.\n  \n  \\see QCPAbstractLegendItem::setTextColor\n*/\nvoid QCPLegend::setTextColor(const QColor &color)\n{\n  mTextColor = color;\n  for (int i=0; i<itemCount(); ++i)\n  {\n    if (item(i))\n      item(i)->setTextColor(color);\n  }\n}\n\n/*!\n  Sets the size of legend icons. Legend items that draw an icon (e.g. a visual\n  representation of the graph) will use this size by default.\n*/\nvoid QCPLegend::setIconSize(const QSize &size)\n{\n  mIconSize = size;\n}\n\n/*! \\overload\n*/\nvoid QCPLegend::setIconSize(int width, int height)\n{\n  mIconSize.setWidth(width);\n  mIconSize.setHeight(height);\n}\n\n/*!\n  Sets the horizontal space in pixels between the legend icon and the text next to it.\n  Legend items that draw an icon (e.g. a visual representation of the graph) and text (e.g. the\n  name of the graph) will use this space by default.\n*/\nvoid QCPLegend::setIconTextPadding(int padding)\n{\n  mIconTextPadding = padding;\n}\n\n/*!\n  Sets the pen used to draw a border around each legend icon. Legend items that draw an\n  icon (e.g. a visual representation of the graph) will use this pen by default.\n  \n  If no border is wanted, set this to \\a Qt::NoPen.\n*/\nvoid QCPLegend::setIconBorderPen(const QPen &pen)\n{\n  mIconBorderPen = pen;\n}\n\n/*!\n  Sets whether the user can (de-)select the parts in \\a selectable by clicking on the QCustomPlot surface.\n  (When \\ref QCustomPlot::setInteractions contains \\ref QCP::iSelectLegend.)\n  \n  However, even when \\a selectable is set to a value not allowing the selection of a specific part,\n  it is still possible to set the selection of this part manually, by calling \\ref setSelectedParts\n  directly.\n  \n  \\see SelectablePart, setSelectedParts\n*/\nvoid QCPLegend::setSelectableParts(const SelectableParts &selectable)\n{\n  if (mSelectableParts != selectable)\n  {\n    mSelectableParts = selectable;\n    emit selectableChanged(mSelectableParts);\n  }\n}\n\n/*!\n  Sets the selected state of the respective legend parts described by \\ref SelectablePart. When a part\n  is selected, it uses a different pen/font and brush. If some legend items are selected and \\a selected\n  doesn't contain \\ref spItems, those items become deselected.\n  \n  The entire selection mechanism is handled automatically when \\ref QCustomPlot::setInteractions\n  contains iSelectLegend. You only need to call this function when you wish to change the selection\n  state manually.\n  \n  This function can change the selection state of a part even when \\ref setSelectableParts was set to a\n  value that actually excludes the part.\n  \n  emits the \\ref selectionChanged signal when \\a selected is different from the previous selection state.\n  \n  Note that it doesn't make sense to set the selected state \\ref spItems here when it wasn't set\n  before, because there's no way to specify which exact items to newly select. Do this by calling\n  \\ref QCPAbstractLegendItem::setSelected directly on the legend item you wish to select.\n  \n  \\see SelectablePart, setSelectableParts, selectTest, setSelectedBorderPen, setSelectedIconBorderPen, setSelectedBrush,\n  setSelectedFont\n*/\nvoid QCPLegend::setSelectedParts(const SelectableParts &selected)\n{\n  SelectableParts newSelected = selected;\n  mSelectedParts = this->selectedParts(); // update mSelectedParts in case item selection changed\n\n  if (mSelectedParts != newSelected)\n  {\n    if (!mSelectedParts.testFlag(spItems) && newSelected.testFlag(spItems)) // attempt to set spItems flag (can't do that)\n    {\n      qDebug() << Q_FUNC_INFO << \"spItems flag can not be set, it can only be unset with this function\";\n      newSelected &= ~spItems;\n    }\n    if (mSelectedParts.testFlag(spItems) && !newSelected.testFlag(spItems)) // spItems flag was unset, so clear item selection\n    {\n      for (int i=0; i<itemCount(); ++i)\n      {\n        if (item(i))\n          item(i)->setSelected(false);\n      }\n    }\n    mSelectedParts = newSelected;\n    emit selectionChanged(mSelectedParts);\n  }\n}\n\n/*!\n  When the legend box is selected, this pen is used to draw the border instead of the normal pen\n  set via \\ref setBorderPen.\n\n  \\see setSelectedParts, setSelectableParts, setSelectedBrush\n*/\nvoid QCPLegend::setSelectedBorderPen(const QPen &pen)\n{\n  mSelectedBorderPen = pen;\n}\n\n/*!\n  Sets the pen legend items will use to draw their icon borders, when they are selected.\n\n  \\see setSelectedParts, setSelectableParts, setSelectedFont\n*/\nvoid QCPLegend::setSelectedIconBorderPen(const QPen &pen)\n{\n  mSelectedIconBorderPen = pen;\n}\n\n/*!\n  When the legend box is selected, this brush is used to draw the legend background instead of the normal brush\n  set via \\ref setBrush.\n\n  \\see setSelectedParts, setSelectableParts, setSelectedBorderPen\n*/\nvoid QCPLegend::setSelectedBrush(const QBrush &brush)\n{\n  mSelectedBrush = brush;\n}\n\n/*!\n  Sets the default font that is used by legend items when they are selected.\n  \n  This function will also set \\a font on all already existing legend items.\n\n  \\see setFont, QCPAbstractLegendItem::setSelectedFont\n*/\nvoid QCPLegend::setSelectedFont(const QFont &font)\n{\n  mSelectedFont = font;\n  for (int i=0; i<itemCount(); ++i)\n  {\n    if (item(i))\n      item(i)->setSelectedFont(font);\n  }\n}\n\n/*!\n  Sets the default text color that is used by legend items when they are selected.\n  \n  This function will also set \\a color on all already existing legend items.\n\n  \\see setTextColor, QCPAbstractLegendItem::setSelectedTextColor\n*/\nvoid QCPLegend::setSelectedTextColor(const QColor &color)\n{\n  mSelectedTextColor = color;\n  for (int i=0; i<itemCount(); ++i)\n  {\n    if (item(i))\n      item(i)->setSelectedTextColor(color);\n  }\n}\n\n/*!\n  Returns the item with index \\a i.\n  \n  \\see itemCount\n*/\nQCPAbstractLegendItem *QCPLegend::item(int index) const\n{\n  return qobject_cast<QCPAbstractLegendItem*>(elementAt(index));\n}\n\n/*!\n  Returns the QCPPlottableLegendItem which is associated with \\a plottable (e.g. a \\ref QCPGraph*).\n  If such an item isn't in the legend, returns 0.\n  \n  \\see hasItemWithPlottable\n*/\nQCPPlottableLegendItem *QCPLegend::itemWithPlottable(const QCPAbstractPlottable *plottable) const\n{\n  for (int i=0; i<itemCount(); ++i)\n  {\n    if (QCPPlottableLegendItem *pli = qobject_cast<QCPPlottableLegendItem*>(item(i)))\n    {\n      if (pli->plottable() == plottable)\n        return pli;\n    }\n  }\n  return 0;\n}\n\n/*!\n  Returns the number of items currently in the legend.\n  \\see item\n*/\nint QCPLegend::itemCount() const\n{\n  return elementCount();\n}\n\n/*!\n  Returns whether the legend contains \\a itm.\n*/\nbool QCPLegend::hasItem(QCPAbstractLegendItem *item) const\n{\n  for (int i=0; i<itemCount(); ++i)\n  {\n    if (item == this->item(i))\n        return true;\n  }\n  return false;\n}\n\n/*!\n  Returns whether the legend contains a QCPPlottableLegendItem which is associated with \\a plottable (e.g. a \\ref QCPGraph*).\n  If such an item isn't in the legend, returns false.\n  \n  \\see itemWithPlottable\n*/\nbool QCPLegend::hasItemWithPlottable(const QCPAbstractPlottable *plottable) const\n{\n  return itemWithPlottable(plottable);\n}\n\n/*!\n  Adds \\a item to the legend, if it's not present already.\n  \n  Returns true on sucess, i.e. if the item wasn't in the list already and has been successfuly added.\n  \n  The legend takes ownership of the item.\n*/\nbool QCPLegend::addItem(QCPAbstractLegendItem *item)\n{\n  if (!hasItem(item))\n  {\n    return addElement(rowCount(), 0, item);\n  } else\n    return false;\n}\n\n/*!\n  Removes the item with index \\a index from the legend.\n\n  Returns true, if successful.\n  \n  \\see itemCount, clearItems\n*/\nbool QCPLegend::removeItem(int index)\n{\n  if (QCPAbstractLegendItem *ali = item(index))\n  {\n    bool success = remove(ali);\n    simplify();\n    return success;\n  } else\n    return false;\n}\n\n/*! \\overload\n  \n  Removes \\a item from the legend.\n\n  Returns true, if successful.\n  \n  \\see clearItems\n*/\nbool QCPLegend::removeItem(QCPAbstractLegendItem *item)\n{\n  bool success = remove(item);\n  simplify();\n  return success;\n}\n\n/*!\n  Removes all items from the legend.\n*/\nvoid QCPLegend::clearItems()\n{\n  for (int i=itemCount()-1; i>=0; --i)\n    removeItem(i);\n}\n\n/*!\n  Returns the legend items that are currently selected. If no items are selected,\n  the list is empty.\n  \n  \\see QCPAbstractLegendItem::setSelected, setSelectable\n*/\nQList<QCPAbstractLegendItem *> QCPLegend::selectedItems() const\n{\n  QList<QCPAbstractLegendItem*> result;\n  for (int i=0; i<itemCount(); ++i)\n  {\n    if (QCPAbstractLegendItem *ali = item(i))\n    {\n      if (ali->selected())\n        result.append(ali);\n    }\n  }\n  return result;\n}\n\n/*! \\internal\n\n  A convenience function to easily set the QPainter::Antialiased hint on the provided \\a painter\n  before drawing main legend elements.\n\n  This is the antialiasing state the painter passed to the \\ref draw method is in by default.\n  \n  This function takes into account the local setting of the antialiasing flag as well as the\n  overrides set with \\ref QCustomPlot::setAntialiasedElements and \\ref\n  QCustomPlot::setNotAntialiasedElements.\n  \n  \\see setAntialiased\n*/\nvoid QCPLegend::applyDefaultAntialiasingHint(QCPPainter *painter) const\n{\n  applyAntialiasingHint(painter, mAntialiased, QCP::aeLegend);\n}\n\n/*! \\internal\n  \n  Returns the pen used to paint the border of the legend, taking into account the selection state\n  of the legend box.\n*/\nQPen QCPLegend::getBorderPen() const\n{\n  return mSelectedParts.testFlag(spLegendBox) ? mSelectedBorderPen : mBorderPen;\n}\n\n/*! \\internal\n  \n  Returns the brush used to paint the background of the legend, taking into account the selection\n  state of the legend box.\n*/\nQBrush QCPLegend::getBrush() const\n{\n  return mSelectedParts.testFlag(spLegendBox) ? mSelectedBrush : mBrush;\n}\n\n/*! \\internal\n  \n  Draws the legend box with the provided \\a painter. The individual legend items are layerables\n  themselves, thus are drawn independently.\n*/\nvoid QCPLegend::draw(QCPPainter *painter)\n{\n  // draw background rect:\n  painter->setBrush(getBrush());\n  painter->setPen(getBorderPen());\n  painter->drawRect(mOuterRect);\n}\n\n/* inherits documentation from base class */\ndouble QCPLegend::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const\n{\n  if (!mParentPlot) return -1;\n  if (onlySelectable && !mSelectableParts.testFlag(spLegendBox))\n    return -1;\n  \n  if (mOuterRect.contains(pos.toPoint()))\n  {\n    if (details) details->setValue(spLegendBox);\n    return mParentPlot->selectionTolerance()*0.99;\n  }\n  return -1;\n}\n\n/* inherits documentation from base class */\nvoid QCPLegend::selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)\n{\n  Q_UNUSED(event)\n  mSelectedParts = selectedParts(); // in case item selection has changed\n  if (details.value<SelectablePart>() == spLegendBox && mSelectableParts.testFlag(spLegendBox))\n  {\n    SelectableParts selBefore = mSelectedParts;\n    setSelectedParts(additive ? mSelectedParts^spLegendBox : mSelectedParts|spLegendBox); // no need to unset spItems in !additive case, because they will be deselected by QCustomPlot (they're normal QCPLayerables with own deselectEvent)\n    if (selectionStateChanged)\n      *selectionStateChanged = mSelectedParts != selBefore;\n  }\n}\n\n/* inherits documentation from base class */\nvoid QCPLegend::deselectEvent(bool *selectionStateChanged)\n{\n  mSelectedParts = selectedParts(); // in case item selection has changed\n  if (mSelectableParts.testFlag(spLegendBox))\n  {\n    SelectableParts selBefore = mSelectedParts;\n    setSelectedParts(selectedParts() & ~spLegendBox);\n    if (selectionStateChanged)\n      *selectionStateChanged = mSelectedParts != selBefore;\n  }\n}\n\n/* inherits documentation from base class */\nQCP::Interaction QCPLegend::selectionCategory() const\n{\n  return QCP::iSelectLegend;\n}\n\n/* inherits documentation from base class */\nQCP::Interaction QCPAbstractLegendItem::selectionCategory() const\n{\n  return QCP::iSelectLegend;\n}\n\n/* inherits documentation from base class */\nvoid QCPLegend::parentPlotInitialized(QCustomPlot *parentPlot)\n{\n  Q_UNUSED(parentPlot)\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPPlotTitle\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPPlotTitle\n  \\brief A layout element displaying a plot title text\n  \n  The text may be specified with \\ref setText, theformatting can be controlled with \\ref setFont\n  and \\ref setTextColor.\n  \n  A plot title can be added as follows:\n  \\code\n  customPlot->plotLayout()->insertRow(0); // inserts an empty row above the default axis rect\n  customPlot->plotLayout()->addElement(0, 0, new QCPPlotTitle(customPlot, \"Your Plot Title\"));\n  \\endcode\n  \n  Since a plot title is a common requirement, QCustomPlot offers specialized selection signals for\n  easy interaction with QCPPlotTitle. If a layout element of type QCPPlotTitle is clicked, the\n  signal \\ref QCustomPlot::titleClick is emitted. A double click emits the \\ref\n  QCustomPlot::titleDoubleClick signal.\n*/\n\n/* start documentation of signals */\n\n/*! \\fn void QCPPlotTitle::selectionChanged(bool selected)\n  \n  This signal is emitted when the selection state has changed to \\a selected, either by user\n  interaction or by a direct call to \\ref setSelected.\n  \n  \\see setSelected, setSelectable\n*/\n\n/* end documentation of signals */\n\n/*!\n  Creates a new QCPPlotTitle instance and sets default values. The initial text is empty (\\ref setText).\n  \n  To set the title text in the constructor, rather use \\ref QCPPlotTitle(QCustomPlot *parentPlot, const QString &text).\n*/\nQCPPlotTitle::QCPPlotTitle(QCustomPlot *parentPlot) :\n  QCPLayoutElement(parentPlot),\n  mFont(QFont(\"sans serif\", 13*1.5, QFont::Bold)),\n  mTextColor(Qt::black),\n  mSelectedFont(QFont(\"sans serif\", 13*1.6, QFont::Bold)),\n  mSelectedTextColor(Qt::blue),\n  mSelectable(false),\n  mSelected(false)\n{\n  if (parentPlot)\n  {\n    setLayer(parentPlot->currentLayer());\n    mFont = QFont(parentPlot->font().family(), parentPlot->font().pointSize()*1.5, QFont::Bold);\n    mSelectedFont = QFont(parentPlot->font().family(), parentPlot->font().pointSize()*1.6, QFont::Bold);\n  }\n  setMargins(QMargins(5, 5, 5, 0));\n}\n\n/*! \\overload\n  \n  Creates a new QCPPlotTitle instance and sets default values. The initial text is set to \\a text.\n*/\nQCPPlotTitle::QCPPlotTitle(QCustomPlot *parentPlot, const QString &text) :\n  QCPLayoutElement(parentPlot),\n  mText(text),\n  mFont(QFont(parentPlot->font().family(), parentPlot->font().pointSize()*1.5, QFont::Bold)),\n  mTextColor(Qt::black),\n  mSelectedFont(QFont(parentPlot->font().family(), parentPlot->font().pointSize()*1.6, QFont::Bold)),\n  mSelectedTextColor(Qt::blue),\n  mSelectable(false),\n  mSelected(false)\n{\n  setLayer(\"axes\");\n  setMargins(QMargins(5, 5, 5, 0));\n}\n\n/*!\n  Sets the text that will be displayed to \\a text. Multiple lines can be created by insertion of \"\\n\".\n  \n  \\see setFont, setTextColor\n*/\nvoid QCPPlotTitle::setText(const QString &text)\n{\n  mText = text;\n}\n\n/*!\n  Sets the \\a font of the title text.\n  \n  \\see setTextColor, setSelectedFont\n*/\nvoid QCPPlotTitle::setFont(const QFont &font)\n{\n  mFont = font;\n}\n\n/*!\n  Sets the \\a color of the title text.\n  \n  \\see setFont, setSelectedTextColor\n*/\nvoid QCPPlotTitle::setTextColor(const QColor &color)\n{\n  mTextColor = color;\n}\n\n/*!\n  Sets the \\a font of the title text that will be used if the plot title is selected (\\ref setSelected).\n  \n  \\see setFont\n*/\nvoid QCPPlotTitle::setSelectedFont(const QFont &font)\n{\n  mSelectedFont = font;\n}\n\n/*!\n  Sets the \\a color of the title text that will be used if the plot title is selected (\\ref setSelected).\n  \n  \\see setTextColor\n*/\nvoid QCPPlotTitle::setSelectedTextColor(const QColor &color)\n{\n  mSelectedTextColor = color;\n}\n\n/*!\n  Sets whether the user may select this plot title to \\a selectable.\n\n  Note that even when \\a selectable is set to <tt>false</tt>, the selection state may be changed\n  programmatically via \\ref setSelected.\n*/\nvoid QCPPlotTitle::setSelectable(bool selectable)\n{\n  if (mSelectable != selectable)\n  {\n    mSelectable = selectable;\n    emit selectableChanged(mSelectable);\n  }\n}\n\n/*!\n  Sets the selection state of this plot title to \\a selected. If the selection has changed, \\ref\n  selectionChanged is emitted.\n  \n  Note that this function can change the selection state independently of the current \\ref\n  setSelectable state.\n*/\nvoid QCPPlotTitle::setSelected(bool selected)\n{\n  if (mSelected != selected)\n  {\n    mSelected = selected;\n    emit selectionChanged(mSelected);\n  }\n}\n\n/* inherits documentation from base class */\nvoid QCPPlotTitle::applyDefaultAntialiasingHint(QCPPainter *painter) const\n{\n  applyAntialiasingHint(painter, mAntialiased, QCP::aeNone);\n}\n\n/* inherits documentation from base class */\nvoid QCPPlotTitle::draw(QCPPainter *painter)\n{\n  painter->setFont(mainFont());\n  painter->setPen(QPen(mainTextColor()));\n  painter->drawText(mRect, Qt::AlignCenter, mText, &mTextBoundingRect);\n}\n\n/* inherits documentation from base class */\nQSize QCPPlotTitle::minimumSizeHint() const\n{\n  QFontMetrics metrics(mFont);\n  QSize result = metrics.boundingRect(0, 0, 0, 0, Qt::AlignCenter, mText).size();\n  result.rwidth() += mMargins.left() + mMargins.right();\n  result.rheight() += mMargins.top() + mMargins.bottom();\n  return result;\n}\n\n/* inherits documentation from base class */\nQSize QCPPlotTitle::maximumSizeHint() const\n{\n  QFontMetrics metrics(mFont);\n  QSize result = metrics.boundingRect(0, 0, 0, 0, Qt::AlignCenter, mText).size();\n  result.rheight() += mMargins.top() + mMargins.bottom();\n  result.setWidth(QWIDGETSIZE_MAX);\n  return result;\n}\n\n/* inherits documentation from base class */\nvoid QCPPlotTitle::selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)\n{\n  Q_UNUSED(event)\n  Q_UNUSED(details)\n  if (mSelectable)\n  {\n    bool selBefore = mSelected;\n    setSelected(additive ? !mSelected : true);\n    if (selectionStateChanged)\n      *selectionStateChanged = mSelected != selBefore;\n  }\n}\n\n/* inherits documentation from base class */\nvoid QCPPlotTitle::deselectEvent(bool *selectionStateChanged)\n{\n  if (mSelectable)\n  {\n    bool selBefore = mSelected;\n    setSelected(false);\n    if (selectionStateChanged)\n      *selectionStateChanged = mSelected != selBefore;\n  }\n}\n\n/* inherits documentation from base class */\ndouble QCPPlotTitle::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const\n{\n  Q_UNUSED(details)\n  if (onlySelectable && !mSelectable)\n    return -1;\n  \n  if (mTextBoundingRect.contains(pos.toPoint()))\n    return mParentPlot->selectionTolerance()*0.99;\n  else\n    return -1;\n}\n\n/*! \\internal\n  \n  Returns the main font to be used. This is mSelectedFont if \\ref setSelected is set to\n  <tt>true</tt>, else mFont is returned.\n*/\nQFont QCPPlotTitle::mainFont() const\n{\n  return mSelected ? mSelectedFont : mFont;\n}\n\n/*! \\internal\n  \n  Returns the main color to be used. This is mSelectedTextColor if \\ref setSelected is set to\n  <tt>true</tt>, else mTextColor is returned.\n*/\nQColor QCPPlotTitle::mainTextColor() const\n{\n  return mSelected ? mSelectedTextColor : mTextColor;\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPColorScale\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPColorScale\n  \\brief A color scale for use with color coding data such as QCPColorMap\n  \n  This layout element can be placed on the plot to correlate a color gradient with data values. It\n  is usually used in combination with one or multiple \\ref QCPColorMap \"QCPColorMaps\".\n\n  \\image html QCPColorScale.png\n  \n  The color scale can be either horizontal or vertical, as shown in the image above. The\n  orientation and the side where the numbers appear is controlled with \\ref setType.\n  \n  Use \\ref QCPColorMap::setColorScale to connect a color map with a color scale. Once they are\n  connected, they share their gradient, data range and data scale type (\\ref setGradient, \\ref\n  setDataRange, \\ref setDataScaleType). Multiple color maps may be associated with a single color\n  scale, to make them all synchronize these properties.\n  \n  To have finer control over the number display and axis behaviour, you can directly access the\n  \\ref axis. See the documentation of QCPAxis for details about configuring axes. For example, if\n  you want to change the number of automatically generated ticks, call\n  \\code\n  colorScale->axis()->setAutoTickCount(3);\n  \\endcode\n  \n  Placing a color scale next to the main axis rect works like with any other layout element:\n  \\code\n  QCPColorScale *colorScale = new QCPColorScale(customPlot);\n  customPlot->plotLayout()->addElement(0, 1, colorScale);\n  colorScale->setLabel(\"Some Label Text\");\n  \\endcode\n  In this case we have placed it to the right of the default axis rect, so it wasn't necessary to\n  call \\ref setType, since \\ref QCPAxis::atRight is already the default. The text next to the color\n  scale can be set with \\ref setLabel.\n  \n  For optimum appearance (like in the image above), it may be desirable to line up the axis rect and\n  the borders of the color scale. Use a \\ref QCPMarginGroup to achieve this:\n  \\code\n  QCPMarginGroup *group = new QCPMarginGroup(customPlot);\n  colorScale->setMarginGroup(QCP::msTop|QCP::msBottom, group);\n  customPlot->axisRect()->setMarginGroup(QCP::msTop|QCP::msBottom, group);\n  \\endcode\n  \n  Color scales are initialized with a non-zero minimum top and bottom margin (\\ref\n  setMinimumMargins), because vertical color scales are most common and the minimum top/bottom\n  margin makes sure it keeps some distance to the top/bottom widget border. So if you change to a\n  horizontal color scale by setting \\ref setType to \\ref QCPAxis::atBottom or \\ref QCPAxis::atTop, you\n  might want to also change the minimum margins accordingly, e.g. \\ref\n  setMinimumMargins(QMargins(6, 0, 6, 0)).\n*/\n\n/* start documentation of inline functions */\n\n/*! \\fn QCPAxis *QCPColorScale::axis() const\n  \n  Returns the internal \\ref QCPAxis instance of this color scale. You can access it to alter the\n  appearance and behaviour of the axis. \\ref QCPColorScale duplicates some properties in its\n  interface for convenience. Those are \\ref setDataRange (\\ref QCPAxis::setRange), \\ref\n  setDataScaleType (\\ref QCPAxis::setScaleType), and the method \\ref setLabel (\\ref\n  QCPAxis::setLabel). As they each are connected, it does not matter whether you use the method on\n  the QCPColorScale or on its QCPAxis.\n  \n  If the type of the color scale is changed with \\ref setType, the axis returned by this method\n  will change, too, to either the left, right, bottom or top axis, depending on which type was set.\n*/\n\n/* end documentation of signals */\n/* start documentation of signals */\n\n/*! \\fn void QCPColorScale::dataRangeChanged(QCPRange newRange);\n  \n  This signal is emitted when the data range changes.\n  \n  \\see setDataRange\n*/\n\n/*! \\fn void QCPColorScale::dataScaleTypeChanged(QCPAxis::ScaleType scaleType);\n  \n  This signal is emitted when the data scale type changes.\n  \n  \\see setDataScaleType\n*/\n\n/*! \\fn void QCPColorScale::gradientChanged(QCPColorGradient newGradient);\n  \n  This signal is emitted when the gradient changes.\n  \n  \\see setGradient\n*/\n\n/* end documentation of signals */\n\n/*!\n  Constructs a new QCPColorScale.\n*/\nQCPColorScale::QCPColorScale(QCustomPlot *parentPlot) :\n  QCPLayoutElement(parentPlot),\n  mType(QCPAxis::atTop), // set to atTop such that setType(QCPAxis::atRight) below doesn't skip work because it thinks it's already atRight\n  mDataScaleType(QCPAxis::stLinear),\n  mBarWidth(20),\n  mAxisRect(new QCPColorScaleAxisRectPrivate(this))\n{\n  setMinimumMargins(QMargins(0, 6, 0, 6)); // for default right color scale types, keep some room at bottom and top (important if no margin group is used)\n  setType(QCPAxis::atRight);\n  setDataRange(QCPRange(0, 6));\n}\n\nQCPColorScale::~QCPColorScale()\n{\n  delete mAxisRect;\n}\n\n/* undocumented getter */\nQString QCPColorScale::label() const\n{\n  if (!mColorAxis)\n  {\n    qDebug() << Q_FUNC_INFO << \"internal color axis undefined\";\n    return QString();\n  }\n  \n  return mColorAxis.data()->label();\n}\n\n/* undocumented getter */\nbool QCPColorScale::rangeDrag() const\n{\n  if (!mAxisRect)\n  {\n    qDebug() << Q_FUNC_INFO << \"internal axis rect was deleted\";\n    return false;\n  }\n  \n  return mAxisRect.data()->rangeDrag().testFlag(QCPAxis::orientation(mType)) &&\n      mAxisRect.data()->rangeDragAxis(QCPAxis::orientation(mType)) &&\n      mAxisRect.data()->rangeDragAxis(QCPAxis::orientation(mType))->orientation() == QCPAxis::orientation(mType);\n}\n\n/* undocumented getter */\nbool QCPColorScale::rangeZoom() const\n{\n  if (!mAxisRect)\n  {\n    qDebug() << Q_FUNC_INFO << \"internal axis rect was deleted\";\n    return false;\n  }\n  \n  return mAxisRect.data()->rangeZoom().testFlag(QCPAxis::orientation(mType)) &&\n      mAxisRect.data()->rangeZoomAxis(QCPAxis::orientation(mType)) &&\n      mAxisRect.data()->rangeZoomAxis(QCPAxis::orientation(mType))->orientation() == QCPAxis::orientation(mType);\n}\n\n/*!\n  Sets at which side of the color scale the axis is placed, and thus also its orientation.\n  \n  Note that after setting \\a type to a different value, the axis returned by \\ref axis() will\n  be a different one. The new axis will adopt the following properties from the previous axis: The\n  range, scale type, log base and label.\n*/\nvoid QCPColorScale::setType(QCPAxis::AxisType type)\n{\n  if (!mAxisRect)\n  {\n    qDebug() << Q_FUNC_INFO << \"internal axis rect was deleted\";\n    return;\n  }\n  if (mType != type)\n  {\n    mType = type;\n    QCPRange rangeTransfer(0, 6);\n    double logBaseTransfer = 10;\n    QString labelTransfer;\n    // revert some settings on old axis:\n    if (mColorAxis)\n    {\n      rangeTransfer = mColorAxis.data()->range();\n      labelTransfer = mColorAxis.data()->label();\n      logBaseTransfer = mColorAxis.data()->scaleLogBase();\n      mColorAxis.data()->setLabel(\"\");\n      disconnect(mColorAxis.data(), SIGNAL(rangeChanged(QCPRange)), this, SLOT(setDataRange(QCPRange)));\n      disconnect(mColorAxis.data(), SIGNAL(scaleTypeChanged(QCPAxis::ScaleType)), this, SLOT(setDataScaleType(QCPAxis::ScaleType)));\n    }\n    foreach (QCPAxis::AxisType atype, QList<QCPAxis::AxisType>() << QCPAxis::atLeft << QCPAxis::atRight << QCPAxis::atBottom << QCPAxis::atTop)\n    {\n      mAxisRect.data()->axis(atype)->setTicks(atype == mType);\n      mAxisRect.data()->axis(atype)->setTickLabels(atype== mType);\n    }\n    // set new mColorAxis pointer:\n    mColorAxis = mAxisRect.data()->axis(mType);\n    // transfer settings to new axis:\n    mColorAxis.data()->setRange(rangeTransfer); // transfer range of old axis to new one (necessary if axis changes from vertical to horizontal or vice versa)\n    mColorAxis.data()->setLabel(labelTransfer);\n    mColorAxis.data()->setScaleLogBase(logBaseTransfer); // scaleType is synchronized among axes in realtime via signals (connected in QCPColorScale ctor), so we only need to take care of log base here\n    connect(mColorAxis.data(), SIGNAL(rangeChanged(QCPRange)), this, SLOT(setDataRange(QCPRange)));\n    connect(mColorAxis.data(), SIGNAL(scaleTypeChanged(QCPAxis::ScaleType)), this, SLOT(setDataScaleType(QCPAxis::ScaleType)));\n    mAxisRect.data()->setRangeDragAxes(QCPAxis::orientation(mType) == Qt::Horizontal ? mColorAxis.data() : 0,\n                                       QCPAxis::orientation(mType) == Qt::Vertical ? mColorAxis.data() : 0);\n  }\n}\n\n/*!\n  Sets the range spanned by the color gradient and that is shown by the axis in the color scale.\n  \n  It is equivalent to calling QCPColorMap::setDataRange on any of the connected color maps. It is\n  also equivalent to directly accessing the \\ref axis and setting its range with \\ref\n  QCPAxis::setRange.\n  \n  \\see setDataScaleType, setGradient, rescaleDataRange\n*/\nvoid QCPColorScale::setDataRange(const QCPRange &dataRange)\n{\n  if (mDataRange.lower != dataRange.lower || mDataRange.upper != dataRange.upper)\n  {\n    mDataRange = dataRange;\n    if (mColorAxis)\n      mColorAxis.data()->setRange(mDataRange);\n    emit dataRangeChanged(mDataRange);\n  }\n}\n\n/*!\n  Sets the scale type of the color scale, i.e. whether values are linearly associated with colors\n  or logarithmically.\n  \n  It is equivalent to calling QCPColorMap::setDataScaleType on any of the connected color maps. It is\n  also equivalent to directly accessing the \\ref axis and setting its scale type with \\ref\n  QCPAxis::setScaleType.\n  \n  \\see setDataRange, setGradient\n*/\nvoid QCPColorScale::setDataScaleType(QCPAxis::ScaleType scaleType)\n{\n  if (mDataScaleType != scaleType)\n  {\n    mDataScaleType = scaleType;\n    if (mColorAxis)\n      mColorAxis.data()->setScaleType(mDataScaleType);\n    if (mDataScaleType == QCPAxis::stLogarithmic)\n      setDataRange(mDataRange.sanitizedForLogScale());\n    emit dataScaleTypeChanged(mDataScaleType);\n  }\n}\n\n/*!\n  Sets the color gradient that will be used to represent data values.\n  \n  It is equivalent to calling QCPColorMap::setGradient on any of the connected color maps.\n  \n  \\see setDataRange, setDataScaleType\n*/\nvoid QCPColorScale::setGradient(const QCPColorGradient &gradient)\n{\n  if (mGradient != gradient)\n  {\n    mGradient = gradient;\n    if (mAxisRect)\n      mAxisRect.data()->mGradientImageInvalidated = true;\n    emit gradientChanged(mGradient);\n  }\n}\n\n/*!\n  Sets the axis label of the color scale. This is equivalent to calling \\ref QCPAxis::setLabel on\n  the internal \\ref axis.\n*/\nvoid QCPColorScale::setLabel(const QString &str)\n{\n  if (!mColorAxis)\n  {\n    qDebug() << Q_FUNC_INFO << \"internal color axis undefined\";\n    return;\n  }\n  \n  mColorAxis.data()->setLabel(str);\n}\n\n/*!\n  Sets the width (or height, for horizontal color scales) the bar where the gradient is displayed\n  will have.\n*/\nvoid QCPColorScale::setBarWidth(int width)\n{\n  mBarWidth = width;\n}\n\n/*!\n  Sets whether the user can drag the data range (\\ref setDataRange).\n  \n  Note that \\ref QCP::iRangeDrag must be in the QCustomPlot's interactions (\\ref\n  QCustomPlot::setInteractions) to allow range dragging.\n*/\nvoid QCPColorScale::setRangeDrag(bool enabled)\n{\n  if (!mAxisRect)\n  {\n    qDebug() << Q_FUNC_INFO << \"internal axis rect was deleted\";\n    return;\n  }\n  \n  if (enabled)\n    mAxisRect.data()->setRangeDrag(QCPAxis::orientation(mType));\n  else\n    mAxisRect.data()->setRangeDrag(0);\n}\n\n/*!\n  Sets whether the user can zoom the data range (\\ref setDataRange) by scrolling the mouse wheel.\n  \n  Note that \\ref QCP::iRangeZoom must be in the QCustomPlot's interactions (\\ref\n  QCustomPlot::setInteractions) to allow range dragging.\n*/\nvoid QCPColorScale::setRangeZoom(bool enabled)\n{\n  if (!mAxisRect)\n  {\n    qDebug() << Q_FUNC_INFO << \"internal axis rect was deleted\";\n    return;\n  }\n  \n  if (enabled)\n    mAxisRect.data()->setRangeZoom(QCPAxis::orientation(mType));\n  else\n    mAxisRect.data()->setRangeZoom(0);\n}\n\n/*!\n  Returns a list of all the color maps associated with this color scale.\n*/\nQList<QCPColorMap*> QCPColorScale::colorMaps() const\n{\n  QList<QCPColorMap*> result;\n  for (int i=0; i<mParentPlot->plottableCount(); ++i)\n  {\n    if (QCPColorMap *cm = qobject_cast<QCPColorMap*>(mParentPlot->plottable(i)))\n      if (cm->colorScale() == this)\n        result.append(cm);\n  }\n  return result;\n}\n\n/*!\n  Changes the data range such that all color maps associated with this color scale are fully mapped\n  to the gradient in the data dimension.\n  \n  \\see setDataRange\n*/\nvoid QCPColorScale::rescaleDataRange(bool onlyVisibleMaps)\n{\n  QList<QCPColorMap*> maps = colorMaps();\n  QCPRange newRange;\n  bool haveRange = false;\n  int sign = 0; // TODO: should change this to QCPAbstractPlottable::SignDomain later (currently is protected, maybe move to QCP namespace)\n  if (mDataScaleType == QCPAxis::stLogarithmic)\n    sign = (mDataRange.upper < 0 ? -1 : 1);\n  for (int i=0; i<maps.size(); ++i)\n  {\n    if (!maps.at(i)->realVisibility() && onlyVisibleMaps)\n      continue;\n    QCPRange mapRange;\n    if (maps.at(i)->colorScale() == this)\n    {\n      bool currentFoundRange = true;\n      mapRange = maps.at(i)->data()->dataBounds();\n      if (sign == 1)\n      {\n        if (mapRange.lower <= 0 && mapRange.upper > 0)\n          mapRange.lower = mapRange.upper*1e-3;\n        else if (mapRange.lower <= 0 && mapRange.upper <= 0)\n          currentFoundRange = false;\n      } else if (sign == -1)\n      {\n        if (mapRange.upper >= 0 && mapRange.lower < 0)\n          mapRange.upper = mapRange.lower*1e-3;\n        else if (mapRange.upper >= 0 && mapRange.lower >= 0)\n          currentFoundRange = false;\n      }\n      if (currentFoundRange)\n      {\n        if (!haveRange)\n          newRange = mapRange;\n        else\n          newRange.expand(mapRange);\n        haveRange = true;\n      }\n    }\n  }\n  if (haveRange)\n  {\n    if (!QCPRange::validRange(newRange)) // likely due to range being zero (plottable has only constant data in this dimension), shift current range to at least center the data\n    {\n      double center = (newRange.lower+newRange.upper)*0.5; // upper and lower should be equal anyway, but just to make sure, incase validRange returned false for other reason\n      if (mDataScaleType == QCPAxis::stLinear)\n      {\n        newRange.lower = center-mDataRange.size()/2.0;\n        newRange.upper = center+mDataRange.size()/2.0;\n      } else // mScaleType == stLogarithmic\n      {\n        newRange.lower = center/qSqrt(mDataRange.upper/mDataRange.lower);\n        newRange.upper = center*qSqrt(mDataRange.upper/mDataRange.lower);\n      }\n    }\n    setDataRange(newRange);\n  }\n}\n\n/* inherits documentation from base class */\nvoid QCPColorScale::update(UpdatePhase phase)\n{\n  QCPLayoutElement::update(phase);\n  if (!mAxisRect)\n  {\n    qDebug() << Q_FUNC_INFO << \"internal axis rect was deleted\";\n    return;\n  }\n  \n  mAxisRect.data()->update(phase);\n  \n  switch (phase)\n  {\n    case upMargins:\n    {\n      if (mType == QCPAxis::atBottom || mType == QCPAxis::atTop)\n      {\n        setMaximumSize(QWIDGETSIZE_MAX, mBarWidth+mAxisRect.data()->margins().top()+mAxisRect.data()->margins().bottom()+margins().top()+margins().bottom());\n        setMinimumSize(0,               mBarWidth+mAxisRect.data()->margins().top()+mAxisRect.data()->margins().bottom()+margins().top()+margins().bottom());\n      } else\n      {\n        setMaximumSize(mBarWidth+mAxisRect.data()->margins().left()+mAxisRect.data()->margins().right()+margins().left()+margins().right(), QWIDGETSIZE_MAX);\n        setMinimumSize(mBarWidth+mAxisRect.data()->margins().left()+mAxisRect.data()->margins().right()+margins().left()+margins().right(), 0);\n      }\n      break;\n    }\n    case upLayout:\n    {\n      mAxisRect.data()->setOuterRect(rect());\n      break;\n    }\n    default: break;\n  }\n}\n\n/* inherits documentation from base class */\nvoid QCPColorScale::applyDefaultAntialiasingHint(QCPPainter *painter) const\n{\n  painter->setAntialiasing(false);\n}\n\n/* inherits documentation from base class */\nvoid QCPColorScale::mousePressEvent(QMouseEvent *event)\n{\n  if (!mAxisRect)\n  {\n    qDebug() << Q_FUNC_INFO << \"internal axis rect was deleted\";\n    return;\n  }\n  mAxisRect.data()->mousePressEvent(event);\n}\n\n/* inherits documentation from base class */\nvoid QCPColorScale::mouseMoveEvent(QMouseEvent *event)\n{\n  if (!mAxisRect)\n  {\n    qDebug() << Q_FUNC_INFO << \"internal axis rect was deleted\";\n    return;\n  }\n  mAxisRect.data()->mouseMoveEvent(event);\n}\n\n/* inherits documentation from base class */\nvoid QCPColorScale::mouseReleaseEvent(QMouseEvent *event)\n{\n  if (!mAxisRect)\n  {\n    qDebug() << Q_FUNC_INFO << \"internal axis rect was deleted\";\n    return;\n  }\n  mAxisRect.data()->mouseReleaseEvent(event);\n}\n\n/* inherits documentation from base class */\nvoid QCPColorScale::wheelEvent(QWheelEvent *event)\n{\n  if (!mAxisRect)\n  {\n    qDebug() << Q_FUNC_INFO << \"internal axis rect was deleted\";\n    return;\n  }\n  mAxisRect.data()->wheelEvent(event);\n}\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPColorScaleAxisRectPrivate\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPColorScaleAxisRectPrivate\n\n  \\internal\n  \\brief An axis rect subclass for use in a QCPColorScale\n  \n  This is a private class and not part of the public QCustomPlot interface.\n  \n  It provides the axis rect functionality for the QCPColorScale class.\n*/\n\n\n/*!\n  Creates a new instance, as a child of \\a parentColorScale.\n*/\nQCPColorScaleAxisRectPrivate::QCPColorScaleAxisRectPrivate(QCPColorScale *parentColorScale) :\n  QCPAxisRect(parentColorScale->parentPlot(), true),\n  mParentColorScale(parentColorScale),\n  mGradientImageInvalidated(true)\n{\n  setParentLayerable(parentColorScale);\n  setMinimumMargins(QMargins(0, 0, 0, 0));\n  foreach (QCPAxis::AxisType type, QList<QCPAxis::AxisType>() << QCPAxis::atBottom << QCPAxis::atTop << QCPAxis::atLeft << QCPAxis::atRight)\n  {\n    axis(type)->setVisible(true);\n    axis(type)->grid()->setVisible(false);\n    axis(type)->setPadding(0);\n    connect(axis(type), SIGNAL(selectionChanged(QCPAxis::SelectableParts)), this, SLOT(axisSelectionChanged(QCPAxis::SelectableParts)));\n    connect(axis(type), SIGNAL(selectableChanged(QCPAxis::SelectableParts)), this, SLOT(axisSelectableChanged(QCPAxis::SelectableParts)));\n  }\n\n  connect(axis(QCPAxis::atLeft), SIGNAL(rangeChanged(QCPRange)), axis(QCPAxis::atRight), SLOT(setRange(QCPRange)));\n  connect(axis(QCPAxis::atRight), SIGNAL(rangeChanged(QCPRange)), axis(QCPAxis::atLeft), SLOT(setRange(QCPRange)));\n  connect(axis(QCPAxis::atBottom), SIGNAL(rangeChanged(QCPRange)), axis(QCPAxis::atTop), SLOT(setRange(QCPRange)));\n  connect(axis(QCPAxis::atTop), SIGNAL(rangeChanged(QCPRange)), axis(QCPAxis::atBottom), SLOT(setRange(QCPRange)));\n  connect(axis(QCPAxis::atLeft), SIGNAL(scaleTypeChanged(QCPAxis::ScaleType)), axis(QCPAxis::atRight), SLOT(setScaleType(QCPAxis::ScaleType)));\n  connect(axis(QCPAxis::atRight), SIGNAL(scaleTypeChanged(QCPAxis::ScaleType)), axis(QCPAxis::atLeft), SLOT(setScaleType(QCPAxis::ScaleType)));\n  connect(axis(QCPAxis::atBottom), SIGNAL(scaleTypeChanged(QCPAxis::ScaleType)), axis(QCPAxis::atTop), SLOT(setScaleType(QCPAxis::ScaleType)));\n  connect(axis(QCPAxis::atTop), SIGNAL(scaleTypeChanged(QCPAxis::ScaleType)), axis(QCPAxis::atBottom), SLOT(setScaleType(QCPAxis::ScaleType)));\n  \n  // make layer transfers of color scale transfer to axis rect and axes\n  // the axes must be set after axis rect, such that they appear above color gradient drawn by axis rect:\n  connect(parentColorScale, SIGNAL(layerChanged(QCPLayer*)), this, SLOT(setLayer(QCPLayer*)));\n  foreach (QCPAxis::AxisType type, QList<QCPAxis::AxisType>() << QCPAxis::atBottom << QCPAxis::atTop << QCPAxis::atLeft << QCPAxis::atRight)\n    connect(parentColorScale, SIGNAL(layerChanged(QCPLayer*)), axis(type), SLOT(setLayer(QCPLayer*)));\n}\n\n/*! \\internal\n  Updates the color gradient image if necessary, by calling \\ref updateGradientImage, then draws\n  it. Then the axes are drawn by calling the \\ref QCPAxisRect::draw base class implementation.\n*/\nvoid QCPColorScaleAxisRectPrivate::draw(QCPPainter *painter)\n{\n  if (mGradientImageInvalidated)\n    updateGradientImage();\n  \n  bool mirrorHorz = false;\n  bool mirrorVert = false;\n  if (mParentColorScale->mColorAxis)\n  {\n    mirrorHorz = mParentColorScale->mColorAxis.data()->rangeReversed() && (mParentColorScale->type() == QCPAxis::atBottom || mParentColorScale->type() == QCPAxis::atTop);\n    mirrorVert = mParentColorScale->mColorAxis.data()->rangeReversed() && (mParentColorScale->type() == QCPAxis::atLeft || mParentColorScale->type() == QCPAxis::atRight);\n  }\n  \n  painter->drawImage(rect(), mGradientImage.mirrored(mirrorHorz, mirrorVert));\n  QCPAxisRect::draw(painter);\n}\n\n/*! \\internal\n\n  Uses the current gradient of the parent \\ref QCPColorScale (specified in the constructor) to\n  generate a gradient image. This gradient image will be used in the \\ref draw method.\n*/\nvoid QCPColorScaleAxisRectPrivate::updateGradientImage()\n{\n  if (rect().isEmpty())\n    return;\n  \n  int n = mParentColorScale->mGradient.levelCount();\n  int w, h;\n  QVector<double> data(n);\n  for (int i=0; i<n; ++i)\n    data[i] = i;\n  if (mParentColorScale->mType == QCPAxis::atBottom || mParentColorScale->mType == QCPAxis::atTop)\n  {\n    w = n;\n    h = rect().height();\n    mGradientImage = QImage(w, h, QImage::Format_RGB32);\n    QVector<QRgb*> pixels;\n    for (int y=0; y<h; ++y)\n      pixels.append(reinterpret_cast<QRgb*>(mGradientImage.scanLine(y)));\n    mParentColorScale->mGradient.colorize(data.constData(), QCPRange(0, n-1), pixels.first(), n);\n    for (int y=1; y<h; ++y)\n      memcpy(pixels.at(y), pixels.first(), n*sizeof(QRgb));\n  } else\n  {\n    w = rect().width();\n    h = n;\n    mGradientImage = QImage(w, h, QImage::Format_RGB32);\n    for (int y=0; y<h; ++y)\n    {\n      QRgb *pixels = reinterpret_cast<QRgb*>(mGradientImage.scanLine(y));\n      const QRgb lineColor = mParentColorScale->mGradient.color(data[h-1-y], QCPRange(0, n-1));\n      for (int x=0; x<w; ++x)\n        pixels[x] = lineColor;\n    }\n  }\n  mGradientImageInvalidated = false;\n}\n\n/*! \\internal\n\n  This slot is connected to the selectionChanged signals of the four axes in the constructor. It\n  synchronizes the selection state of the axes.\n*/\nvoid QCPColorScaleAxisRectPrivate::axisSelectionChanged(QCPAxis::SelectableParts selectedParts)\n{\n  // axis bases of four axes shall always (de-)selected synchronously:\n  foreach (QCPAxis::AxisType type, QList<QCPAxis::AxisType>() << QCPAxis::atBottom << QCPAxis::atTop << QCPAxis::atLeft << QCPAxis::atRight)\n  {\n    if (QCPAxis *senderAxis = qobject_cast<QCPAxis*>(sender()))\n      if (senderAxis->axisType() == type)\n        continue;\n    \n    if (axis(type)->selectableParts().testFlag(QCPAxis::spAxis))\n    {\n      if (selectedParts.testFlag(QCPAxis::spAxis))\n        axis(type)->setSelectedParts(axis(type)->selectedParts() | QCPAxis::spAxis);\n      else\n        axis(type)->setSelectedParts(axis(type)->selectedParts() & ~QCPAxis::spAxis);\n    }\n  }\n}\n\n/*! \\internal\n\n  This slot is connected to the selectableChanged signals of the four axes in the constructor. It\n  synchronizes the selectability of the axes.\n*/\nvoid QCPColorScaleAxisRectPrivate::axisSelectableChanged(QCPAxis::SelectableParts selectableParts)\n{\n  // synchronize axis base selectability:\n  foreach (QCPAxis::AxisType type, QList<QCPAxis::AxisType>() << QCPAxis::atBottom << QCPAxis::atTop << QCPAxis::atLeft << QCPAxis::atRight)\n  {\n    if (QCPAxis *senderAxis = qobject_cast<QCPAxis*>(sender()))\n      if (senderAxis->axisType() == type)\n        continue;\n    \n    if (axis(type)->selectableParts().testFlag(QCPAxis::spAxis))\n    {\n      if (selectableParts.testFlag(QCPAxis::spAxis))\n        axis(type)->setSelectableParts(axis(type)->selectableParts() | QCPAxis::spAxis);\n      else\n        axis(type)->setSelectableParts(axis(type)->selectableParts() & ~QCPAxis::spAxis);\n    }\n  }\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPData\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPData\n  \\brief Holds the data of one single data point for QCPGraph.\n  \n  The container for storing multiple data points is \\ref QCPDataMap.\n  \n  The stored data is:\n  \\li \\a key: coordinate on the key axis of this data point\n  \\li \\a value: coordinate on the value axis of this data point\n  \\li \\a keyErrorMinus: negative error in the key dimension (for error bars)\n  \\li \\a keyErrorPlus: positive error in the key dimension (for error bars)\n  \\li \\a valueErrorMinus: negative error in the value dimension (for error bars)\n  \\li \\a valueErrorPlus: positive error in the value dimension (for error bars)\n  \n  \\see QCPDataMap\n*/\n\n/*!\n  Constructs a data point with key, value and all errors set to zero.\n*/\nQCPData::QCPData() :\n  key(0),\n  value(0),\n  keyErrorPlus(0),\n  keyErrorMinus(0),\n  valueErrorPlus(0),\n  valueErrorMinus(0)\n{\n}\n\n/*!\n  Constructs a data point with the specified \\a key and \\a value. All errors are set to zero.\n*/\nQCPData::QCPData(double key, double value) :\n  key(key),\n  value(value),\n  keyErrorPlus(0),\n  keyErrorMinus(0),\n  valueErrorPlus(0),\n  valueErrorMinus(0)\n{\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPGraph\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPGraph\n  \\brief A plottable representing a graph in a plot.\n\n  \\image html QCPGraph.png\n  \n  Usually QCustomPlot creates graphs internally via QCustomPlot::addGraph and the resulting\n  instance is accessed via QCustomPlot::graph.\n\n  To plot data, assign it with the \\ref setData or \\ref addData functions. Alternatively, you can\n  also access and modify the graph's data via the \\ref data method, which returns a pointer to the\n  internal \\ref QCPDataMap.\n  \n  Graphs are used to display single-valued data. Single-valued means that there should only be one\n  data point per unique key coordinate. In other words, the graph can't have \\a loops. If you do\n  want to plot non-single-valued curves, rather use the QCPCurve plottable.\n  \n  \\section appearance Changing the appearance\n  \n  The appearance of the graph is mainly determined by the line style, scatter style, brush and pen\n  of the graph (\\ref setLineStyle, \\ref setScatterStyle, \\ref setBrush, \\ref setPen).\n  \n  \\subsection filling Filling under or between graphs\n  \n  QCPGraph knows two types of fills: Normal graph fills towards the zero-value-line parallel to\n  the key axis of the graph, and fills between two graphs, called channel fills. To enable a fill,\n  just set a brush with \\ref setBrush which is neither Qt::NoBrush nor fully transparent.\n  \n  By default, a normal fill towards the zero-value-line will be drawn. To set up a channel fill\n  between this graph and another one, call \\ref setChannelFillGraph with the other graph as\n  parameter.\n\n  \\see QCustomPlot::addGraph, QCustomPlot::graph, QCPLegend::addGraph\n*/\n\n/* start of documentation of inline functions */\n\n/*! \\fn QCPDataMap *QCPGraph::data() const\n  \n  Returns a pointer to the internal data storage of type \\ref QCPDataMap. You may use it to\n  directly manipulate the data, which may be more convenient and faster than using the regular \\ref\n  setData or \\ref addData methods, in certain situations.\n*/\n\n/* end of documentation of inline functions */\n\n/*!\n  Constructs a graph which uses \\a keyAxis as its key axis (\"x\") and \\a valueAxis as its value\n  axis (\"y\"). \\a keyAxis and \\a valueAxis must reside in the same QCustomPlot instance and not have\n  the same orientation. If either of these restrictions is violated, a corresponding message is\n  printed to the debug output (qDebug), the construction is not aborted, though.\n  \n  The constructed QCPGraph can be added to the plot with QCustomPlot::addPlottable, QCustomPlot\n  then takes ownership of the graph.\n  \n  To directly create a graph inside a plot, you can also use the simpler QCustomPlot::addGraph function.\n*/\nQCPGraph::QCPGraph(QCPAxis *keyAxis, QCPAxis *valueAxis) :\n  QCPAbstractPlottable(keyAxis, valueAxis)\n{\n  mData = new QCPDataMap;\n  \n  setPen(QPen(Qt::blue, 0));\n  setErrorPen(QPen(Qt::black));\n  setBrush(Qt::NoBrush);\n  setSelectedPen(QPen(QColor(80, 80, 255), 2.5));\n  setSelectedBrush(Qt::NoBrush);\n  \n  setLineStyle(lsLine);\n  setErrorType(etNone);\n  setErrorBarSize(6);\n  setErrorBarSkipSymbol(true);\n  setChannelFillGraph(0);\n  setAdaptiveSampling(true);\n}\n\nQCPGraph::~QCPGraph()\n{\n  delete mData;\n}\n\n/*!\n  Replaces the current data with the provided \\a data.\n  \n  If \\a copy is set to true, data points in \\a data will only be copied. if false, the graph\n  takes ownership of the passed data and replaces the internal data pointer with it. This is\n  significantly faster than copying for large datasets.\n  \n  Alternatively, you can also access and modify the graph's data via the \\ref data method, which\n  returns a pointer to the internal \\ref QCPDataMap.\n*/\nvoid QCPGraph::setData(QCPDataMap *data, bool copy)\n{\n  if (copy)\n  {\n    *mData = *data;\n  } else\n  {\n    delete mData;\n    mData = data;\n  }\n}\n\n/*! \\overload\n  \n  Replaces the current data with the provided points in \\a key and \\a value pairs. The provided\n  vectors should have equal length. Else, the number of added points will be the size of the\n  smallest vector.\n*/\nvoid QCPGraph::setData(const QVector<double> &key, const QVector<double> &value)\n{\n  mData->clear();\n  int n = key.size();\n  n = qMin(n, value.size());\n  QCPData newData;\n  for (int i=0; i<n; ++i)\n  {\n    newData.key = key[i];\n    newData.value = value[i];\n    mData->insertMulti(newData.key, newData);\n  }\n}\n\n/*!\n  Replaces the current data with the provided points in \\a key and \\a value pairs. Additionally the\n  symmetrical value error of the data points are set to the values in \\a valueError.\n  For error bars to show appropriately, see \\ref setErrorType.\n  The provided vectors should have equal length. Else, the number of added points will be the size of the\n  smallest vector.\n  \n  For asymmetrical errors (plus different from minus), see the overloaded version of this function.\n*/\nvoid QCPGraph::setDataValueError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &valueError)\n{\n  mData->clear();\n  int n = key.size();\n  n = qMin(n, value.size());\n  n = qMin(n, valueError.size());\n  QCPData newData;\n  for (int i=0; i<n; ++i)\n  {\n    newData.key = key[i];\n    newData.value = value[i];\n    newData.valueErrorMinus = valueError[i];\n    newData.valueErrorPlus = valueError[i];\n    mData->insertMulti(key[i], newData);\n  }\n}\n\n/*!\n  \\overload\n  Replaces the current data with the provided points in \\a key and \\a value pairs. Additionally the\n  negative value error of the data points are set to the values in \\a valueErrorMinus, the positive\n  value error to \\a valueErrorPlus.\n  For error bars to show appropriately, see \\ref setErrorType.\n  The provided vectors should have equal length. Else, the number of added points will be the size of the\n  smallest vector.\n*/\nvoid QCPGraph::setDataValueError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &valueErrorMinus, const QVector<double> &valueErrorPlus)\n{\n  mData->clear();\n  int n = key.size();\n  n = qMin(n, value.size());\n  n = qMin(n, valueErrorMinus.size());\n  n = qMin(n, valueErrorPlus.size());\n  QCPData newData;\n  for (int i=0; i<n; ++i)\n  {\n    newData.key = key[i];\n    newData.value = value[i];\n    newData.valueErrorMinus = valueErrorMinus[i];\n    newData.valueErrorPlus = valueErrorPlus[i];\n    mData->insertMulti(key[i], newData);\n  }\n}\n\n/*!\n  Replaces the current data with the provided points in \\a key and \\a value pairs. Additionally the\n  symmetrical key error of the data points are set to the values in \\a keyError.\n  For error bars to show appropriately, see \\ref setErrorType.\n  The provided vectors should have equal length. Else, the number of added points will be the size of the\n  smallest vector.\n  \n  For asymmetrical errors (plus different from minus), see the overloaded version of this function.\n*/\nvoid QCPGraph::setDataKeyError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &keyError)\n{\n  mData->clear();\n  int n = key.size();\n  n = qMin(n, value.size());\n  n = qMin(n, keyError.size());\n  QCPData newData;\n  for (int i=0; i<n; ++i)\n  {\n    newData.key = key[i];\n    newData.value = value[i];\n    newData.keyErrorMinus = keyError[i];\n    newData.keyErrorPlus = keyError[i];\n    mData->insertMulti(key[i], newData);\n  }\n}\n\n/*!\n  \\overload\n  Replaces the current data with the provided points in \\a key and \\a value pairs. Additionally the\n  negative key error of the data points are set to the values in \\a keyErrorMinus, the positive\n  key error to \\a keyErrorPlus.\n  For error bars to show appropriately, see \\ref setErrorType.\n  The provided vectors should have equal length. Else, the number of added points will be the size of the\n  smallest vector.\n*/\nvoid QCPGraph::setDataKeyError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &keyErrorMinus, const QVector<double> &keyErrorPlus)\n{\n  mData->clear();\n  int n = key.size();\n  n = qMin(n, value.size());\n  n = qMin(n, keyErrorMinus.size());\n  n = qMin(n, keyErrorPlus.size());\n  QCPData newData;\n  for (int i=0; i<n; ++i)\n  {\n    newData.key = key[i];\n    newData.value = value[i];\n    newData.keyErrorMinus = keyErrorMinus[i];\n    newData.keyErrorPlus = keyErrorPlus[i];\n    mData->insertMulti(key[i], newData);\n  }\n}\n\n/*!\n  Replaces the current data with the provided points in \\a key and \\a value pairs. Additionally the\n  symmetrical key and value errors of the data points are set to the values in \\a keyError and \\a valueError.\n  For error bars to show appropriately, see \\ref setErrorType.\n  The provided vectors should have equal length. Else, the number of added points will be the size of the\n  smallest vector.\n  \n  For asymmetrical errors (plus different from minus), see the overloaded version of this function.\n*/\nvoid QCPGraph::setDataBothError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &keyError, const QVector<double> &valueError)\n{\n  mData->clear();\n  int n = key.size();\n  n = qMin(n, value.size());\n  n = qMin(n, valueError.size());\n  n = qMin(n, keyError.size());\n  QCPData newData;\n  for (int i=0; i<n; ++i)\n  {\n    newData.key = key[i];\n    newData.value = value[i];\n    newData.keyErrorMinus = keyError[i];\n    newData.keyErrorPlus = keyError[i];\n    newData.valueErrorMinus = valueError[i];\n    newData.valueErrorPlus = valueError[i];\n    mData->insertMulti(key[i], newData);\n  }\n}\n\n/*!\n  \\overload\n  Replaces the current data with the provided points in \\a key and \\a value pairs. Additionally the\n  negative key and value errors of the data points are set to the values in \\a keyErrorMinus and \\a valueErrorMinus. The positive\n  key and value errors are set to the values in \\a keyErrorPlus \\a valueErrorPlus.\n  For error bars to show appropriately, see \\ref setErrorType.\n  The provided vectors should have equal length. Else, the number of added points will be the size of the\n  smallest vector.\n*/\nvoid QCPGraph::setDataBothError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &keyErrorMinus, const QVector<double> &keyErrorPlus, const QVector<double> &valueErrorMinus, const QVector<double> &valueErrorPlus)\n{\n  mData->clear();\n  int n = key.size();\n  n = qMin(n, value.size());\n  n = qMin(n, valueErrorMinus.size());\n  n = qMin(n, valueErrorPlus.size());\n  n = qMin(n, keyErrorMinus.size());\n  n = qMin(n, keyErrorPlus.size());\n  QCPData newData;\n  for (int i=0; i<n; ++i)\n  {\n    newData.key = key[i];\n    newData.value = value[i];\n    newData.keyErrorMinus = keyErrorMinus[i];\n    newData.keyErrorPlus = keyErrorPlus[i];\n    newData.valueErrorMinus = valueErrorMinus[i];\n    newData.valueErrorPlus = valueErrorPlus[i];\n    mData->insertMulti(key[i], newData);\n  }\n}\n\n\n/*!\n  Sets how the single data points are connected in the plot. For scatter-only plots, set \\a ls to\n  \\ref lsNone and \\ref setScatterStyle to the desired scatter style.\n  \n  \\see setScatterStyle\n*/\nvoid QCPGraph::setLineStyle(LineStyle ls)\n{\n  mLineStyle = ls;\n}\n\n/*!\n  Sets the visual appearance of single data points in the plot. If set to \\ref QCPScatterStyle::ssNone, no scatter points\n  are drawn (e.g. for line-only-plots with appropriate line style).\n  \n  \\see QCPScatterStyle, setLineStyle\n*/\nvoid QCPGraph::setScatterStyle(const QCPScatterStyle &style)\n{\n  mScatterStyle = style;\n}\n\n/*!\n  Sets which kind of error bars (Key Error, Value Error or both) should be drawn on each data\n  point. If you set \\a errorType to something other than \\ref etNone, make sure to actually pass\n  error data via the specific setData functions along with the data points (e.g. \\ref\n  setDataValueError, \\ref setDataKeyError, \\ref setDataBothError).\n\n  \\see ErrorType\n*/\nvoid QCPGraph::setErrorType(ErrorType errorType)\n{\n  mErrorType = errorType;\n}\n\n/*!\n  Sets the pen with which the error bars will be drawn.\n  \\see setErrorBarSize, setErrorType\n*/\nvoid QCPGraph::setErrorPen(const QPen &pen)\n{\n  mErrorPen = pen;\n}\n\n/*!\n  Sets the width of the handles at both ends of an error bar in pixels.\n*/\nvoid QCPGraph::setErrorBarSize(double size)\n{\n  mErrorBarSize = size;\n}\n\n/*!\n  If \\a enabled is set to true, the error bar will not be drawn as a solid line under the scatter symbol but\n  leave some free space around the symbol.\n  \n  This feature uses the current scatter size (\\ref QCPScatterStyle::setSize) to determine the size\n  of the area to leave blank. So when drawing Pixmaps as scatter points (\\ref\n  QCPScatterStyle::ssPixmap), the scatter size must be set manually to a value corresponding to the\n  size of the Pixmap, if the error bars should leave gaps to its boundaries.\n  \n  \\ref setErrorType, setErrorBarSize, setScatterStyle\n*/\nvoid QCPGraph::setErrorBarSkipSymbol(bool enabled)\n{\n  mErrorBarSkipSymbol = enabled;\n}\n\n/*!\n  Sets the target graph for filling the area between this graph and \\a targetGraph with the current\n  brush (\\ref setBrush).\n  \n  When \\a targetGraph is set to 0, a normal graph fill to the zero-value-line will be shown. To\n  disable any filling, set the brush to Qt::NoBrush.\n\n  \\see setBrush\n*/\nvoid QCPGraph::setChannelFillGraph(QCPGraph *targetGraph)\n{\n  // prevent setting channel target to this graph itself:\n  if (targetGraph == this)\n  {\n    qDebug() << Q_FUNC_INFO << \"targetGraph is this graph itself\";\n    mChannelFillGraph = 0;\n    return;\n  }\n  // prevent setting channel target to a graph not in the plot:\n  if (targetGraph && targetGraph->mParentPlot != mParentPlot)\n  {\n    qDebug() << Q_FUNC_INFO << \"targetGraph not in same plot\";\n    mChannelFillGraph = 0;\n    return;\n  }\n  \n  mChannelFillGraph = targetGraph;\n}\n\n/*!\n  Sets whether adaptive sampling shall be used when plotting this graph. QCustomPlot's adaptive\n  sampling technique can drastically improve the replot performance for graphs with a larger number\n  of points (e.g. above 10,000), without notably changing the appearance of the graph.\n  \n  By default, adaptive sampling is enabled. Even if enabled, QCustomPlot decides whether adaptive\n  sampling shall actually be used on a per-graph basis. So leaving adaptive sampling enabled has no\n  disadvantage in almost all cases.\n  \n  \\image html adaptive-sampling-line.png \"A line plot of 500,000 points without and with adaptive sampling\"\n  \n  As can be seen, line plots experience no visual degradation from adaptive sampling. Outliers are\n  reproduced reliably, as well as the overall shape of the data set. The replot time reduces\n  dramatically though. This allows QCustomPlot to display large amounts of data in realtime.\n  \n  \\image html adaptive-sampling-scatter.png \"A scatter plot of 100,000 points without and with adaptive sampling\"\n  \n  Care must be taken when using high-density scatter plots in combination with adaptive sampling.\n  The adaptive sampling algorithm treats scatter plots more carefully than line plots which still\n  gives a significant reduction of replot times, but not quite as much as for line plots. This is\n  because scatter plots inherently need more data points to be preserved in order to still resemble\n  the original, non-adaptive-sampling plot. As shown above, the results still aren't quite\n  identical, as banding occurs for the outer data points. This is in fact intentional, such that\n  the boundaries of the data cloud stay visible to the viewer. How strong the banding appears,\n  depends on the point density, i.e. the number of points in the plot.\n  \n  For some situations with scatter plots it might thus be desirable to manually turn adaptive\n  sampling off. For example, when saving the plot to disk. This can be achieved by setting \\a\n  enabled to false before issuing a command like \\ref QCustomPlot::savePng, and setting \\a enabled\n  back to true afterwards.\n*/\nvoid QCPGraph::setAdaptiveSampling(bool enabled)\n{\n  mAdaptiveSampling = enabled;\n}\n\n/*!\n  Adds the provided data points in \\a dataMap to the current data.\n  \n  Alternatively, you can also access and modify the graph's data via the \\ref data method, which\n  returns a pointer to the internal \\ref QCPDataMap.\n  \n  \\see removeData\n*/\nvoid QCPGraph::addData(const QCPDataMap &dataMap)\n{\n  mData->unite(dataMap);\n}\n\n/*! \\overload\n  Adds the provided single data point in \\a data to the current data.\n  \n  Alternatively, you can also access and modify the graph's data via the \\ref data method, which\n  returns a pointer to the internal \\ref QCPDataMap.\n  \n  \\see removeData\n*/\nvoid QCPGraph::addData(const QCPData &data)\n{\n  mData->insertMulti(data.key, data);\n}\n\n/*! \\overload\n  Adds the provided single data point as \\a key and \\a value pair to the current data.\n  \n  Alternatively, you can also access and modify the graph's data via the \\ref data method, which\n  returns a pointer to the internal \\ref QCPDataMap.\n  \n  \\see removeData\n*/\nvoid QCPGraph::addData(double key, double value)\n{\n  QCPData newData;\n  newData.key = key;\n  newData.value = value;\n  mData->insertMulti(newData.key, newData);\n}\n\n/*! \\overload\n  Adds the provided data points as \\a key and \\a value pairs to the current data.\n  \n  Alternatively, you can also access and modify the graph's data via the \\ref data method, which\n  returns a pointer to the internal \\ref QCPDataMap.\n  \n  \\see removeData\n*/\nvoid QCPGraph::addData(const QVector<double> &keys, const QVector<double> &values)\n{\n  int n = qMin(keys.size(), values.size());\n  QCPData newData;\n  for (int i=0; i<n; ++i)\n  {\n    newData.key = keys[i];\n    newData.value = values[i];\n    mData->insertMulti(newData.key, newData);\n  }\n}\n\n/*!\n  Removes all data points with keys smaller than \\a key.\n  \\see addData, clearData\n*/\nvoid QCPGraph::removeDataBefore(double key)\n{\n  QCPDataMap::iterator it = mData->begin();\n  while (it != mData->end() && it.key() < key)\n    it = mData->erase(it);\n}\n\n/*!\n  Removes all data points with keys greater than \\a key.\n  \\see addData, clearData\n*/\nvoid QCPGraph::removeDataAfter(double key)\n{\n  if (mData->isEmpty()) return;\n  QCPDataMap::iterator it = mData->upperBound(key);\n  while (it != mData->end())\n    it = mData->erase(it);\n}\n\n/*!\n  Removes all data points with keys between \\a fromKey and \\a toKey.\n  if \\a fromKey is greater or equal to \\a toKey, the function does nothing. To remove\n  a single data point with known key, use \\ref removeData(double key).\n  \n  \\see addData, clearData\n*/\nvoid QCPGraph::removeData(double fromKey, double toKey)\n{\n  if (fromKey >= toKey || mData->isEmpty()) return;\n  QCPDataMap::iterator it = mData->upperBound(fromKey);\n  QCPDataMap::iterator itEnd = mData->upperBound(toKey);\n  while (it != itEnd)\n    it = mData->erase(it);\n}\n\n/*! \\overload\n  \n  Removes a single data point at \\a key. If the position is not known with absolute precision,\n  consider using \\ref removeData(double fromKey, double toKey) with a small fuzziness interval around\n  the suspected position, depeding on the precision with which the key is known.\n\n  \\see addData, clearData\n*/\nvoid QCPGraph::removeData(double key)\n{\n  mData->remove(key);\n}\n\n/*!\n  Removes all data points.\n  \\see removeData, removeDataAfter, removeDataBefore\n*/\nvoid QCPGraph::clearData()\n{\n  mData->clear();\n}\n\n/* inherits documentation from base class */\ndouble QCPGraph::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const\n{\n  Q_UNUSED(details)\n  if ((onlySelectable && !mSelectable) || mData->isEmpty())\n    return -1;\n  if (!mKeyAxis || !mValueAxis) { qDebug() << Q_FUNC_INFO << \"invalid key or value axis\"; return -1; }\n  \n  if (mKeyAxis.data()->axisRect()->rect().contains(pos.toPoint()))\n    return pointDistance(pos);\n  else\n    return -1;\n}\n\n/*! \\overload\n  \n  Allows to define whether error bars are taken into consideration when determining the new axis\n  range.\n  \n  \\see rescaleKeyAxis, rescaleValueAxis, QCPAbstractPlottable::rescaleAxes, QCustomPlot::rescaleAxes\n*/\nvoid QCPGraph::rescaleAxes(bool onlyEnlarge, bool includeErrorBars) const\n{\n  rescaleKeyAxis(onlyEnlarge, includeErrorBars);\n  rescaleValueAxis(onlyEnlarge, includeErrorBars);\n}\n\n/*! \\overload\n  \n  Allows to define whether error bars (of kind \\ref QCPGraph::etKey) are taken into consideration\n  when determining the new axis range.\n  \n  \\see rescaleAxes, QCPAbstractPlottable::rescaleKeyAxis\n*/\nvoid QCPGraph::rescaleKeyAxis(bool onlyEnlarge, bool includeErrorBars) const\n{\n  // this code is a copy of QCPAbstractPlottable::rescaleKeyAxis with the only change\n  // that getKeyRange is passed the includeErrorBars value.\n  if (mData->isEmpty()) return;\n  \n  QCPAxis *keyAxis = mKeyAxis.data();\n  if (!keyAxis) { qDebug() << Q_FUNC_INFO << \"invalid key axis\"; return; }\n\n  SignDomain signDomain = sdBoth;\n  if (keyAxis->scaleType() == QCPAxis::stLogarithmic)\n    signDomain = (keyAxis->range().upper < 0 ? sdNegative : sdPositive);\n  \n  bool foundRange;\n  QCPRange newRange = getKeyRange(foundRange, signDomain, includeErrorBars);\n  \n  if (foundRange)\n  {\n    if (onlyEnlarge)\n    {\n      if (keyAxis->range().lower < newRange.lower)\n        newRange.lower = keyAxis->range().lower;\n      if (keyAxis->range().upper > newRange.upper)\n        newRange.upper = keyAxis->range().upper;\n    }\n    keyAxis->setRange(newRange);\n  }\n}\n\n/*! \\overload\n  \n  Allows to define whether error bars (of kind \\ref QCPGraph::etValue) are taken into consideration\n  when determining the new axis range.\n  \n  \\see rescaleAxes, QCPAbstractPlottable::rescaleValueAxis\n*/\nvoid QCPGraph::rescaleValueAxis(bool onlyEnlarge, bool includeErrorBars) const\n{\n  // this code is a copy of QCPAbstractPlottable::rescaleValueAxis with the only change\n  // is that getValueRange is passed the includeErrorBars value.\n  if (mData->isEmpty()) return;\n  \n  QCPAxis *valueAxis = mValueAxis.data();\n  if (!valueAxis) { qDebug() << Q_FUNC_INFO << \"invalid value axis\"; return; }\n\n  SignDomain signDomain = sdBoth;\n  if (valueAxis->scaleType() == QCPAxis::stLogarithmic)\n    signDomain = (valueAxis->range().upper < 0 ? sdNegative : sdPositive);\n  \n  bool foundRange;\n  QCPRange newRange = getValueRange(foundRange, signDomain, includeErrorBars);\n  \n  if (foundRange)\n  {\n    if (onlyEnlarge)\n    {\n      if (valueAxis->range().lower < newRange.lower)\n        newRange.lower = valueAxis->range().lower;\n      if (valueAxis->range().upper > newRange.upper)\n        newRange.upper = valueAxis->range().upper;\n    }\n    valueAxis->setRange(newRange);\n  }\n}\n\n/* inherits documentation from base class */\nvoid QCPGraph::draw(QCPPainter *painter)\n{\n  if (!mKeyAxis || !mValueAxis) { qDebug() << Q_FUNC_INFO << \"invalid key or value axis\"; return; }\n  if (mKeyAxis.data()->range().size() <= 0 || mData->isEmpty()) return;\n  if (mLineStyle == lsNone && mScatterStyle.isNone()) return;\n  \n  // allocate line and (if necessary) point vectors:\n  QVector<QPointF> *lineData = new QVector<QPointF>;\n  QVector<QCPData> *scatterData = 0;\n  if (!mScatterStyle.isNone())\n    scatterData = new QVector<QCPData>;\n  \n  // fill vectors with data appropriate to plot style:\n  getPlotData(lineData, scatterData);\n  \n  // check data validity if flag set:\n#ifdef QCUSTOMPLOT_CHECK_DATA\n  QCPDataMap::const_iterator it;\n  for (it = mData->constBegin(); it != mData->constEnd(); ++it)\n  {\n    if (QCP::isInvalidData(it.value().key, it.value().value) ||\n        QCP::isInvalidData(it.value().keyErrorPlus, it.value().keyErrorMinus) ||\n        QCP::isInvalidData(it.value().valueErrorPlus, it.value().valueErrorPlus))\n      qDebug() << Q_FUNC_INFO << \"Data point at\" << it.key() << \"invalid.\" << \"Plottable name:\" << name();\n  }\n#endif\n\n  // draw fill of graph:\n  drawFill(painter, lineData);\n  \n  // draw line:\n  if (mLineStyle == lsImpulse)\n    drawImpulsePlot(painter, lineData);\n  else if (mLineStyle != lsNone)\n    drawLinePlot(painter, lineData); // also step plots can be drawn as a line plot\n  \n  // draw scatters:\n  if (scatterData)\n    drawScatterPlot(painter, scatterData);\n  \n  // free allocated line and point vectors:\n  delete lineData;\n  if (scatterData)\n    delete scatterData;\n}\n\n/* inherits documentation from base class */\nvoid QCPGraph::drawLegendIcon(QCPPainter *painter, const QRectF &rect) const\n{\n  // draw fill:\n  if (mBrush.style() != Qt::NoBrush)\n  {\n    applyFillAntialiasingHint(painter);\n    painter->fillRect(QRectF(rect.left(), rect.top()+rect.height()/2.0, rect.width(), rect.height()/3.0), mBrush);\n  }\n  // draw line vertically centered:\n  if (mLineStyle != lsNone)\n  {\n    applyDefaultAntialiasingHint(painter);\n    painter->setPen(mPen);\n    painter->drawLine(QLineF(rect.left(), rect.top()+rect.height()/2.0, rect.right()+5, rect.top()+rect.height()/2.0)); // +5 on x2 else last segment is missing from dashed/dotted pens\n  }\n  // draw scatter symbol:\n  if (!mScatterStyle.isNone())\n  {\n    applyScattersAntialiasingHint(painter);\n    // scale scatter pixmap if it's too large to fit in legend icon rect:\n    if (mScatterStyle.shape() == QCPScatterStyle::ssPixmap && (mScatterStyle.pixmap().size().width() > rect.width() || mScatterStyle.pixmap().size().height() > rect.height()))\n    {\n      QCPScatterStyle scaledStyle(mScatterStyle);\n      scaledStyle.setPixmap(scaledStyle.pixmap().scaled(rect.size().toSize(), Qt::KeepAspectRatio, Qt::SmoothTransformation));\n      scaledStyle.applyTo(painter, mPen);\n      scaledStyle.drawShape(painter, QRectF(rect).center());\n    } else\n    {\n      mScatterStyle.applyTo(painter, mPen);\n      mScatterStyle.drawShape(painter, QRectF(rect).center());\n    }\n  }\n}\n\n/*! \\internal\n\n  This function branches out to the line style specific \"get(...)PlotData\" functions, according to\n  the line style of the graph.\n  \n  \\a lineData will be filled with raw points that will be drawn with the according draw functions,\n  e.g. \\ref drawLinePlot and \\ref drawImpulsePlot. These aren't necessarily the original data\n  points, since for step plots for example, additional points are needed for drawing lines that\n  make up steps. If the line style of the graph is \\ref lsNone, the \\a lineData vector will be left\n  untouched.\n  \n  \\a scatterData will be filled with the original data points so \\ref drawScatterPlot can draw the\n  scatter symbols accordingly. If no scatters need to be drawn, i.e. the scatter style's shape is\n  \\ref QCPScatterStyle::ssNone, pass 0 as \\a scatterData, and this step will be skipped.\n  \n  \\see getScatterPlotData, getLinePlotData, getStepLeftPlotData, getStepRightPlotData,\n  getStepCenterPlotData, getImpulsePlotData\n*/\nvoid QCPGraph::getPlotData(QVector<QPointF> *lineData, QVector<QCPData> *scatterData) const\n{\n  switch(mLineStyle)\n  {\n    case lsNone: getScatterPlotData(scatterData); break;\n    case lsLine: getLinePlotData(lineData, scatterData); break;\n    case lsStepLeft: getStepLeftPlotData(lineData, scatterData); break;\n    case lsStepRight: getStepRightPlotData(lineData, scatterData); break;\n    case lsStepCenter: getStepCenterPlotData(lineData, scatterData); break;\n    case lsImpulse: getImpulsePlotData(lineData, scatterData); break;\n  }\n}\n\n/*! \\internal\n  \n  If line style is \\ref lsNone and the scatter style's shape is not \\ref QCPScatterStyle::ssNone,\n  this function serves at providing the visible data points in \\a scatterData, so the \\ref\n  drawScatterPlot function can draw the scatter points accordingly.\n  \n  If line style is not \\ref lsNone, this function is not called and the data for the scatter points\n  are (if needed) calculated inside the corresponding other \"get(...)PlotData\" functions.\n  \n  \\see drawScatterPlot\n*/\nvoid QCPGraph::getScatterPlotData(QVector<QCPData> *scatterData) const\n{\n  getPreparedData(0, scatterData);\n}\n\n/*! \\internal\n  \n  Places the raw data points needed for a normal linearly connected graph in \\a linePixelData.\n\n  As for all plot data retrieval functions, \\a scatterData just contains all unaltered data (scatter)\n  points that are visible for drawing scatter points, if necessary. If drawing scatter points is\n  disabled (i.e. the scatter style's shape is \\ref QCPScatterStyle::ssNone), pass 0 as \\a\n  scatterData, and the function will skip filling the vector.\n  \n  \\see drawLinePlot\n*/\nvoid QCPGraph::getLinePlotData(QVector<QPointF> *linePixelData, QVector<QCPData> *scatterData) const\n{\n  QCPAxis *keyAxis = mKeyAxis.data();\n  QCPAxis *valueAxis = mValueAxis.data();\n  if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << \"invalid key or value axis\"; return; }\n  if (!linePixelData) { qDebug() << Q_FUNC_INFO << \"null pointer passed as linePixelData\"; return; }\n  \n  QVector<QCPData> lineData;\n  getPreparedData(&lineData, scatterData);\n  linePixelData->reserve(lineData.size()+2); // added 2 to reserve memory for lower/upper fill base points that might be needed for fill\n  linePixelData->resize(lineData.size());\n  \n  // transform lineData points to pixels:\n  if (keyAxis->orientation() == Qt::Vertical)\n  {\n    for (int i=0; i<lineData.size(); ++i)\n    {\n      (*linePixelData)[i].setX(valueAxis->coordToPixel(lineData.at(i).value));\n      (*linePixelData)[i].setY(keyAxis->coordToPixel(lineData.at(i).key));\n    }\n  } else // key axis is horizontal\n  {\n    for (int i=0; i<lineData.size(); ++i)\n    {\n      (*linePixelData)[i].setX(keyAxis->coordToPixel(lineData.at(i).key));\n      (*linePixelData)[i].setY(valueAxis->coordToPixel(lineData.at(i).value));\n    }\n  }\n}\n\n/*!\n  \\internal\n  Places the raw data points needed for a step plot with left oriented steps in \\a lineData.\n\n  As for all plot data retrieval functions, \\a scatterData just contains all unaltered data (scatter)\n  points that are visible for drawing scatter points, if necessary. If drawing scatter points is\n  disabled (i.e. the scatter style's shape is \\ref QCPScatterStyle::ssNone), pass 0 as \\a\n  scatterData, and the function will skip filling the vector.\n  \n  \\see drawLinePlot\n*/\nvoid QCPGraph::getStepLeftPlotData(QVector<QPointF> *linePixelData, QVector<QCPData> *scatterData) const\n{\n  QCPAxis *keyAxis = mKeyAxis.data();\n  QCPAxis *valueAxis = mValueAxis.data();\n  if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << \"invalid key or value axis\"; return; }\n  if (!linePixelData) { qDebug() << Q_FUNC_INFO << \"null pointer passed as lineData\"; return; }\n  \n  QVector<QCPData> lineData;\n  getPreparedData(&lineData, scatterData);\n  linePixelData->reserve(lineData.size()*2+2); // added 2 to reserve memory for lower/upper fill base points that might be needed for fill\n  linePixelData->resize(lineData.size()*2);\n  \n  // calculate steps from lineData and transform to pixel coordinates:\n  if (keyAxis->orientation() == Qt::Vertical)\n  {\n    double lastValue = valueAxis->coordToPixel(lineData.first().value);\n    double key;\n    for (int i=0; i<lineData.size(); ++i)\n    {\n      key = keyAxis->coordToPixel(lineData.at(i).key);\n      (*linePixelData)[i*2+0].setX(lastValue);\n      (*linePixelData)[i*2+0].setY(key);\n      lastValue = valueAxis->coordToPixel(lineData.at(i).value);\n      (*linePixelData)[i*2+1].setX(lastValue);\n      (*linePixelData)[i*2+1].setY(key);\n    }\n  } else // key axis is horizontal\n  {\n    double lastValue = valueAxis->coordToPixel(lineData.first().value);\n    double key;\n    for (int i=0; i<lineData.size(); ++i)\n    {\n      key = keyAxis->coordToPixel(lineData.at(i).key);\n      (*linePixelData)[i*2+0].setX(key);\n      (*linePixelData)[i*2+0].setY(lastValue);\n      lastValue = valueAxis->coordToPixel(lineData.at(i).value);\n      (*linePixelData)[i*2+1].setX(key);\n      (*linePixelData)[i*2+1].setY(lastValue);\n    }\n  }\n}\n\n/*!\n  \\internal\n  Places the raw data points needed for a step plot with right oriented steps in \\a lineData.\n\n  As for all plot data retrieval functions, \\a scatterData just contains all unaltered data (scatter)\n  points that are visible for drawing scatter points, if necessary. If drawing scatter points is\n  disabled (i.e. the scatter style's shape is \\ref QCPScatterStyle::ssNone), pass 0 as \\a\n  scatterData, and the function will skip filling the vector.\n  \n  \\see drawLinePlot\n*/\nvoid QCPGraph::getStepRightPlotData(QVector<QPointF> *linePixelData, QVector<QCPData> *scatterData) const\n{\n  QCPAxis *keyAxis = mKeyAxis.data();\n  QCPAxis *valueAxis = mValueAxis.data();\n  if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << \"invalid key or value axis\"; return; }\n  if (!linePixelData) { qDebug() << Q_FUNC_INFO << \"null pointer passed as lineData\"; return; }\n  \n  QVector<QCPData> lineData;\n  getPreparedData(&lineData, scatterData);\n  linePixelData->reserve(lineData.size()*2+2); // added 2 to reserve memory for lower/upper fill base points that might be needed for fill\n  linePixelData->resize(lineData.size()*2);\n  \n  // calculate steps from lineData and transform to pixel coordinates:\n  if (keyAxis->orientation() == Qt::Vertical)\n  {\n    double lastKey = keyAxis->coordToPixel(lineData.first().key);\n    double value;\n    for (int i=0; i<lineData.size(); ++i)\n    {\n      value = valueAxis->coordToPixel(lineData.at(i).value);\n      (*linePixelData)[i*2+0].setX(value);\n      (*linePixelData)[i*2+0].setY(lastKey);\n      lastKey = keyAxis->coordToPixel(lineData.at(i).key);\n      (*linePixelData)[i*2+1].setX(value);\n      (*linePixelData)[i*2+1].setY(lastKey);\n    }\n  } else // key axis is horizontal\n  {\n    double lastKey = keyAxis->coordToPixel(lineData.first().key);\n    double value;\n    for (int i=0; i<lineData.size(); ++i)\n    {\n      value = valueAxis->coordToPixel(lineData.at(i).value);\n      (*linePixelData)[i*2+0].setX(lastKey);\n      (*linePixelData)[i*2+0].setY(value);\n      lastKey = keyAxis->coordToPixel(lineData.at(i).key);\n      (*linePixelData)[i*2+1].setX(lastKey);\n      (*linePixelData)[i*2+1].setY(value);\n    }\n  }\n}\n\n/*!\n  \\internal\n  Places the raw data points needed for a step plot with centered steps in \\a lineData.\n\n  As for all plot data retrieval functions, \\a scatterData just contains all unaltered data (scatter)\n  points that are visible for drawing scatter points, if necessary. If drawing scatter points is\n  disabled (i.e. the scatter style's shape is \\ref QCPScatterStyle::ssNone), pass 0 as \\a\n  scatterData, and the function will skip filling the vector.\n  \n  \\see drawLinePlot\n*/\nvoid QCPGraph::getStepCenterPlotData(QVector<QPointF> *linePixelData, QVector<QCPData> *scatterData) const\n{\n  QCPAxis *keyAxis = mKeyAxis.data();\n  QCPAxis *valueAxis = mValueAxis.data();\n  if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << \"invalid key or value axis\"; return; }\n  if (!linePixelData) { qDebug() << Q_FUNC_INFO << \"null pointer passed as lineData\"; return; }\n  \n  QVector<QCPData> lineData;\n  getPreparedData(&lineData, scatterData);\n  linePixelData->reserve(lineData.size()*2+2); // added 2 to reserve memory for lower/upper fill base points that might be needed for fill\n  linePixelData->resize(lineData.size()*2);\n  // calculate steps from lineData and transform to pixel coordinates:\n  if (keyAxis->orientation() == Qt::Vertical)\n  {\n    double lastKey = keyAxis->coordToPixel(lineData.first().key);\n    double lastValue = valueAxis->coordToPixel(lineData.first().value);\n    double key;\n    (*linePixelData)[0].setX(lastValue);\n    (*linePixelData)[0].setY(lastKey);\n    for (int i=1; i<lineData.size(); ++i)\n    {\n      key = (keyAxis->coordToPixel(lineData.at(i).key)+lastKey)*0.5;\n      (*linePixelData)[i*2-1].setX(lastValue);\n      (*linePixelData)[i*2-1].setY(key);\n      lastValue = valueAxis->coordToPixel(lineData.at(i).value);\n      lastKey = keyAxis->coordToPixel(lineData.at(i).key);\n      (*linePixelData)[i*2+0].setX(lastValue);\n      (*linePixelData)[i*2+0].setY(key);\n    }\n    (*linePixelData)[lineData.size()*2-1].setX(lastValue);\n    (*linePixelData)[lineData.size()*2-1].setY(lastKey);\n  } else // key axis is horizontal\n  {\n    double lastKey = keyAxis->coordToPixel(lineData.first().key);\n    double lastValue = valueAxis->coordToPixel(lineData.first().value);\n    double key;\n    (*linePixelData)[0].setX(lastKey);\n    (*linePixelData)[0].setY(lastValue);\n    for (int i=1; i<lineData.size(); ++i)\n    {\n      key = (keyAxis->coordToPixel(lineData.at(i).key)+lastKey)*0.5;\n      (*linePixelData)[i*2-1].setX(key);\n      (*linePixelData)[i*2-1].setY(lastValue);\n      lastValue = valueAxis->coordToPixel(lineData.at(i).value);\n      lastKey = keyAxis->coordToPixel(lineData.at(i).key);\n      (*linePixelData)[i*2+0].setX(key);\n      (*linePixelData)[i*2+0].setY(lastValue);\n    }\n    (*linePixelData)[lineData.size()*2-1].setX(lastKey);\n    (*linePixelData)[lineData.size()*2-1].setY(lastValue);\n  }\n\n}\n\n/*!\n  \\internal\n  Places the raw data points needed for an impulse plot in \\a lineData.\n\n  As for all plot data retrieval functions, \\a scatterData just contains all unaltered data (scatter)\n  points that are visible for drawing scatter points, if necessary. If drawing scatter points is\n  disabled (i.e. the scatter style's shape is \\ref QCPScatterStyle::ssNone), pass 0 as \\a\n  scatterData, and the function will skip filling the vector.\n  \n  \\see drawImpulsePlot\n*/\nvoid QCPGraph::getImpulsePlotData(QVector<QPointF> *linePixelData, QVector<QCPData> *scatterData) const\n{\n  QCPAxis *keyAxis = mKeyAxis.data();\n  QCPAxis *valueAxis = mValueAxis.data();\n  if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << \"invalid key or value axis\"; return; }\n  if (!linePixelData) { qDebug() << Q_FUNC_INFO << \"null pointer passed as linePixelData\"; return; }\n  \n  QVector<QCPData> lineData;\n  getPreparedData(&lineData, scatterData);\n  linePixelData->resize(lineData.size()*2); // no need to reserve 2 extra points because impulse plot has no fill\n  \n  // transform lineData points to pixels:\n  if (keyAxis->orientation() == Qt::Vertical)\n  {\n    double zeroPointX = valueAxis->coordToPixel(0);\n    double key;\n    for (int i=0; i<lineData.size(); ++i)\n    {\n      key = keyAxis->coordToPixel(lineData.at(i).key);\n      (*linePixelData)[i*2+0].setX(zeroPointX);\n      (*linePixelData)[i*2+0].setY(key);\n      (*linePixelData)[i*2+1].setX(valueAxis->coordToPixel(lineData.at(i).value));\n      (*linePixelData)[i*2+1].setY(key);\n    }\n  } else // key axis is horizontal\n  {\n    double zeroPointY = valueAxis->coordToPixel(0);\n    double key;\n    for (int i=0; i<lineData.size(); ++i)\n    {\n      key = keyAxis->coordToPixel(lineData.at(i).key);\n      (*linePixelData)[i*2+0].setX(key);\n      (*linePixelData)[i*2+0].setY(zeroPointY);\n      (*linePixelData)[i*2+1].setX(key);\n      (*linePixelData)[i*2+1].setY(valueAxis->coordToPixel(lineData.at(i).value));\n    }\n  }\n}\n\n/*! \\internal\n  \n  Draws the fill of the graph with the specified brush.\n\n  If the fill is a normal fill towards the zero-value-line, only the \\a lineData is required (and\n  two extra points at the zero-value-line, which are added by \\ref addFillBasePoints and removed by\n  \\ref removeFillBasePoints after the fill drawing is done).\n  \n  If the fill is a channel fill between this QCPGraph and another QCPGraph (mChannelFillGraph), the\n  more complex polygon is calculated with the \\ref getChannelFillPolygon function.\n  \n  \\see drawLinePlot\n*/\nvoid QCPGraph::drawFill(QCPPainter *painter, QVector<QPointF> *lineData) const\n{\n  if (mLineStyle == lsImpulse) return; // fill doesn't make sense for impulse plot\n  if (mainBrush().style() == Qt::NoBrush || mainBrush().color().alpha() == 0) return;\n  \n  applyFillAntialiasingHint(painter);\n  if (!mChannelFillGraph)\n  {\n    // draw base fill under graph, fill goes all the way to the zero-value-line:\n    addFillBasePoints(lineData);\n    painter->setPen(Qt::NoPen);\n    painter->setBrush(mainBrush());\n    painter->drawPolygon(QPolygonF(*lineData));\n    removeFillBasePoints(lineData);\n  } else\n  {\n    // draw channel fill between this graph and mChannelFillGraph:\n    painter->setPen(Qt::NoPen);\n    painter->setBrush(mainBrush());\n    painter->drawPolygon(getChannelFillPolygon(lineData));\n  }\n}\n\n/*! \\internal\n  \n  Draws scatter symbols at every data point passed in \\a scatterData. scatter symbols are independent\n  of the line style and are always drawn if the scatter style's shape is not \\ref\n  QCPScatterStyle::ssNone. Hence, the \\a scatterData vector is outputted by all \"get(...)PlotData\"\n  functions, together with the (line style dependent) line data.\n  \n  \\see drawLinePlot, drawImpulsePlot\n*/\nvoid QCPGraph::drawScatterPlot(QCPPainter *painter, QVector<QCPData> *scatterData) const\n{\n  QCPAxis *keyAxis = mKeyAxis.data();\n  QCPAxis *valueAxis = mValueAxis.data();\n  if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << \"invalid key or value axis\"; return; }\n  \n  // draw error bars:\n  if (mErrorType != etNone)\n  {\n    applyErrorBarsAntialiasingHint(painter);\n    painter->setPen(mErrorPen);\n    if (keyAxis->orientation() == Qt::Vertical)\n    {\n      for (int i=0; i<scatterData->size(); ++i)\n        drawError(painter, valueAxis->coordToPixel(scatterData->at(i).value), keyAxis->coordToPixel(scatterData->at(i).key), scatterData->at(i));\n    } else\n    {\n      for (int i=0; i<scatterData->size(); ++i)\n        drawError(painter, keyAxis->coordToPixel(scatterData->at(i).key), valueAxis->coordToPixel(scatterData->at(i).value), scatterData->at(i));\n    }\n  }\n  \n  // draw scatter point symbols:\n  applyScattersAntialiasingHint(painter);\n  mScatterStyle.applyTo(painter, mPen);\n  if (keyAxis->orientation() == Qt::Vertical)\n  {\n    for (int i=0; i<scatterData->size(); ++i)\n      mScatterStyle.drawShape(painter, valueAxis->coordToPixel(scatterData->at(i).value), keyAxis->coordToPixel(scatterData->at(i).key));\n  } else\n  {\n    for (int i=0; i<scatterData->size(); ++i)\n      mScatterStyle.drawShape(painter, keyAxis->coordToPixel(scatterData->at(i).key), valueAxis->coordToPixel(scatterData->at(i).value));\n  }\n}\n\n/*!  \\internal\n  \n  Draws line graphs from the provided data. It connects all points in \\a lineData, which was\n  created by one of the \"get(...)PlotData\" functions for line styles that require simple line\n  connections between the point vector they create. These are for example \\ref getLinePlotData,\n  \\ref getStepLeftPlotData, \\ref getStepRightPlotData and \\ref getStepCenterPlotData.\n  \n  \\see drawScatterPlot, drawImpulsePlot\n*/\nvoid QCPGraph::drawLinePlot(QCPPainter *painter, QVector<QPointF> *lineData) const\n{\n  // draw line of graph:\n  if (mainPen().style() != Qt::NoPen && mainPen().color().alpha() != 0)\n  {\n    applyDefaultAntialiasingHint(painter);\n    painter->setPen(mainPen());\n    painter->setBrush(Qt::NoBrush);\n    \n    /* Draws polyline in batches, currently not used:\n    int p = 0;\n    while (p < lineData->size())\n    {\n      int batch = qMin(25, lineData->size()-p);\n      if (p != 0)\n      {\n        ++batch;\n        --p; // to draw the connection lines between two batches\n      }\n      painter->drawPolyline(lineData->constData()+p, batch);\n      p += batch;\n    }\n    */\n    \n    // if drawing solid line and not in PDF, use much faster line drawing instead of polyline:\n    if (mParentPlot->plottingHints().testFlag(QCP::phFastPolylines) &&\n        painter->pen().style() == Qt::SolidLine &&\n        !painter->modes().testFlag(QCPPainter::pmVectorized)&&\n        !painter->modes().testFlag(QCPPainter::pmNoCaching))\n    {\n      for (int i=1; i<lineData->size(); ++i)\n        painter->drawLine(lineData->at(i-1), lineData->at(i));\n    } else\n    {\n      painter->drawPolyline(QPolygonF(*lineData));\n    }\n  }\n}\n\n/*! \\internal\n  \n  Draws impulses from the provided data, i.e. it connects all line pairs in \\a lineData, which was\n  created by \\ref getImpulsePlotData.\n  \n  \\see drawScatterPlot, drawLinePlot\n*/\nvoid QCPGraph::drawImpulsePlot(QCPPainter *painter, QVector<QPointF> *lineData) const\n{\n  // draw impulses:\n  if (mainPen().style() != Qt::NoPen && mainPen().color().alpha() != 0)\n  {\n    applyDefaultAntialiasingHint(painter);\n    QPen pen = mainPen();\n    pen.setCapStyle(Qt::FlatCap); // so impulse line doesn't reach beyond zero-line\n    painter->setPen(pen);\n    painter->setBrush(Qt::NoBrush);\n    painter->drawLines(*lineData);\n  }\n}\n\n/*! \\internal\n  \n  Returns the \\a lineData and \\a scatterData that need to be plotted for this graph taking into\n  consideration the current axis ranges and, if \\ref setAdaptiveSampling is enabled, local point\n  densities.\n  \n  0 may be passed as \\a lineData or \\a scatterData to indicate that the respective dataset isn't\n  needed. For example, if the scatter style (\\ref setScatterStyle) is \\ref QCPScatterStyle::ssNone, \\a\n  scatterData should be 0 to prevent unnecessary calculations.\n  \n  This method is used by the various \"get(...)PlotData\" methods to get the basic working set of data.\n*/\nvoid QCPGraph::getPreparedData(QVector<QCPData> *lineData, QVector<QCPData> *scatterData) const\n{\n  QCPAxis *keyAxis = mKeyAxis.data();\n  QCPAxis *valueAxis = mValueAxis.data();\n  if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << \"invalid key or value axis\"; return; }\n  // get visible data range:\n  QCPDataMap::const_iterator lower, upper; // note that upper is the actual upper point, and not 1 step after the upper point\n  getVisibleDataBounds(lower, upper);\n  if (lower == mData->constEnd() || upper == mData->constEnd())\n    return;\n  \n  // count points in visible range, taking into account that we only need to count to the limit maxCount if using adaptive sampling:\n  int maxCount = std::numeric_limits<int>::max();\n  if (mAdaptiveSampling)\n  {\n    int keyPixelSpan = qAbs(keyAxis->coordToPixel(lower.key())-keyAxis->coordToPixel(upper.key()));\n    maxCount = 2*keyPixelSpan+2;\n  }\n  int dataCount = countDataInBounds(lower, upper, maxCount);\n  \n  if (mAdaptiveSampling && dataCount >= maxCount) // use adaptive sampling only if there are at least two points per pixel on average\n  {\n    if (lineData)\n    {\n      QCPDataMap::const_iterator it = lower;\n      QCPDataMap::const_iterator upperEnd = upper+1;\n      double minValue = it.value().value;\n      double maxValue = it.value().value;\n      QCPDataMap::const_iterator currentIntervalFirstPoint = it;\n      int reversedFactor = keyAxis->rangeReversed() ? -1 : 1; // is used to calculate keyEpsilon pixel into the correct direction\n      int reversedRound = keyAxis->rangeReversed() ? 1 : 0; // is used to switch between floor (normal) and ceil (reversed) rounding of currentIntervalStartKey\n      double currentIntervalStartKey = keyAxis->pixelToCoord((int)(keyAxis->coordToPixel(lower.key())+reversedRound));\n      double lastIntervalEndKey = currentIntervalStartKey;\n      double keyEpsilon = qAbs(currentIntervalStartKey-keyAxis->pixelToCoord(keyAxis->coordToPixel(currentIntervalStartKey)+1.0*reversedFactor)); // interval of one pixel on screen when mapped to plot key coordinates\n      bool keyEpsilonVariable = keyAxis->scaleType() == QCPAxis::stLogarithmic; // indicates whether keyEpsilon needs to be updated after every interval (for log axes)\n      int intervalDataCount = 1;\n      ++it; // advance iterator to second data point because adaptive sampling works in 1 point retrospect\n      while (it != upperEnd)\n      {\n        if (it.key() < currentIntervalStartKey+keyEpsilon) // data point is still within same pixel, so skip it and expand value span of this cluster if necessary\n        {\n          if (it.value().value < minValue)\n            minValue = it.value().value;\n          else if (it.value().value > maxValue)\n            maxValue = it.value().value;\n          ++intervalDataCount;\n        } else // new pixel interval started\n        {\n          if (intervalDataCount >= 2) // last pixel had multiple data points, consolidate them to a cluster\n          {\n            if (lastIntervalEndKey < currentIntervalStartKey-keyEpsilon) // last point is further away, so first point of this cluster must be at a real data point\n              lineData->append(QCPData(currentIntervalStartKey+keyEpsilon*0.2, currentIntervalFirstPoint.value().value));\n            lineData->append(QCPData(currentIntervalStartKey+keyEpsilon*0.25, minValue));\n            lineData->append(QCPData(currentIntervalStartKey+keyEpsilon*0.75, maxValue));\n            if (it.key() > currentIntervalStartKey+keyEpsilon*2) // new pixel started further away from previous cluster, so make sure the last point of the cluster is at a real data point\n              lineData->append(QCPData(currentIntervalStartKey+keyEpsilon*0.8, (it-1).value().value));\n          } else\n            lineData->append(QCPData(currentIntervalFirstPoint.key(), currentIntervalFirstPoint.value().value));\n          lastIntervalEndKey = (it-1).value().key;\n          minValue = it.value().value;\n          maxValue = it.value().value;\n          currentIntervalFirstPoint = it;\n          currentIntervalStartKey = keyAxis->pixelToCoord((int)(keyAxis->coordToPixel(it.key())+reversedRound));\n          if (keyEpsilonVariable)\n            keyEpsilon = qAbs(currentIntervalStartKey-keyAxis->pixelToCoord(keyAxis->coordToPixel(currentIntervalStartKey)+1.0*reversedFactor));\n          intervalDataCount = 1;\n        }\n        ++it;\n      }\n      // handle last interval:\n      if (intervalDataCount >= 2) // last pixel had multiple data points, consolidate them to a cluster\n      {\n        if (lastIntervalEndKey < currentIntervalStartKey-keyEpsilon) // last point wasn't a cluster, so first point of this cluster must be at a real data point\n          lineData->append(QCPData(currentIntervalStartKey+keyEpsilon*0.2, currentIntervalFirstPoint.value().value));\n        lineData->append(QCPData(currentIntervalStartKey+keyEpsilon*0.25, minValue));\n        lineData->append(QCPData(currentIntervalStartKey+keyEpsilon*0.75, maxValue));\n      } else\n        lineData->append(QCPData(currentIntervalFirstPoint.key(), currentIntervalFirstPoint.value().value));\n    }\n    \n    if (scatterData)\n    {\n      double valueMaxRange = valueAxis->range().upper;\n      double valueMinRange = valueAxis->range().lower;\n      QCPDataMap::const_iterator it = lower;\n      QCPDataMap::const_iterator upperEnd = upper+1;\n      double minValue = it.value().value;\n      double maxValue = it.value().value;\n      QCPDataMap::const_iterator minValueIt = it;\n      QCPDataMap::const_iterator maxValueIt = it;\n      QCPDataMap::const_iterator currentIntervalStart = it;\n      int reversedFactor = keyAxis->rangeReversed() ? -1 : 1; // is used to calculate keyEpsilon pixel into the correct direction\n      int reversedRound = keyAxis->rangeReversed() ? 1 : 0; // is used to switch between floor (normal) and ceil (reversed) rounding of currentIntervalStartKey\n      double currentIntervalStartKey = keyAxis->pixelToCoord((int)(keyAxis->coordToPixel(lower.key())+reversedRound));\n      double keyEpsilon = qAbs(currentIntervalStartKey-keyAxis->pixelToCoord(keyAxis->coordToPixel(currentIntervalStartKey)+1.0*reversedFactor)); // interval of one pixel on screen when mapped to plot key coordinates\n      bool keyEpsilonVariable = keyAxis->scaleType() == QCPAxis::stLogarithmic; // indicates whether keyEpsilon needs to be updated after every interval (for log axes)\n      int intervalDataCount = 1;\n      ++it; // advance iterator to second data point because adaptive sampling works in 1 point retrospect\n      while (it != upperEnd)\n      {\n        if (it.key() < currentIntervalStartKey+keyEpsilon) // data point is still within same pixel, so skip it and expand value span of this pixel if necessary\n        {\n          if (it.value().value < minValue && it.value().value > valueMinRange && it.value().value < valueMaxRange)\n          {\n            minValue = it.value().value;\n            minValueIt = it;\n          } else if (it.value().value > maxValue && it.value().value > valueMinRange && it.value().value < valueMaxRange)\n          {\n            maxValue = it.value().value;\n            maxValueIt = it;\n          }\n          ++intervalDataCount;\n        } else // new pixel started\n        {\n          if (intervalDataCount >= 2) // last pixel had multiple data points, consolidate them\n          {\n            // determine value pixel span and add as many points in interval to maintain certain vertical data density (this is specific to scatter plot):\n            double valuePixelSpan = qAbs(valueAxis->coordToPixel(minValue)-valueAxis->coordToPixel(maxValue));\n            int dataModulo = qMax(1, qRound(intervalDataCount/(valuePixelSpan/4.0))); // approximately every 4 value pixels one data point on average\n            QCPDataMap::const_iterator intervalIt = currentIntervalStart;\n            int c = 0;\n            while (intervalIt != it)\n            {\n              if ((c % dataModulo == 0 || intervalIt == minValueIt || intervalIt == maxValueIt) && intervalIt.value().value > valueMinRange && intervalIt.value().value < valueMaxRange)\n                scatterData->append(intervalIt.value());\n              ++c;\n              ++intervalIt;\n            }\n          } else if (currentIntervalStart.value().value > valueMinRange && currentIntervalStart.value().value < valueMaxRange)\n            scatterData->append(currentIntervalStart.value());\n          minValue = it.value().value;\n          maxValue = it.value().value;\n          currentIntervalStart = it;\n          currentIntervalStartKey = keyAxis->pixelToCoord((int)(keyAxis->coordToPixel(it.key())+reversedRound));\n          if (keyEpsilonVariable)\n            keyEpsilon = qAbs(currentIntervalStartKey-keyAxis->pixelToCoord(keyAxis->coordToPixel(currentIntervalStartKey)+1.0*reversedFactor));\n          intervalDataCount = 1;\n        }\n        ++it;\n      }\n      // handle last interval:\n      if (intervalDataCount >= 2) // last pixel had multiple data points, consolidate them\n      {\n        // determine value pixel span and add as many points in interval to maintain certain vertical data density (this is specific to scatter plot):\n        double valuePixelSpan = qAbs(valueAxis->coordToPixel(minValue)-valueAxis->coordToPixel(maxValue));\n        int dataModulo = qMax(1, qRound(intervalDataCount/(valuePixelSpan/4.0))); // approximately every 4 value pixels one data point on average\n        QCPDataMap::const_iterator intervalIt = currentIntervalStart;\n        int c = 0;\n        while (intervalIt != it)\n        {\n          if ((c % dataModulo == 0 || intervalIt == minValueIt || intervalIt == maxValueIt) && intervalIt.value().value > valueMinRange && intervalIt.value().value < valueMaxRange)\n            scatterData->append(intervalIt.value());\n          ++c;\n          ++intervalIt;\n        }\n      } else if (currentIntervalStart.value().value > valueMinRange && currentIntervalStart.value().value < valueMaxRange)\n        scatterData->append(currentIntervalStart.value());\n    }\n  } else // don't use adaptive sampling algorithm, transfer points one-to-one from the map into the output parameters\n  {\n    QVector<QCPData> *dataVector = 0;\n    if (lineData)\n      dataVector = lineData;\n    else if (scatterData)\n      dataVector = scatterData;\n    if (dataVector)\n    {\n      QCPDataMap::const_iterator it = lower;\n      QCPDataMap::const_iterator upperEnd = upper+1;\n      dataVector->reserve(dataCount+2); // +2 for possible fill end points\n      while (it != upperEnd)\n      {\n        dataVector->append(it.value());\n        ++it;\n      }\n    }\n    if (lineData && scatterData)\n      *scatterData = *dataVector;\n  }\n}\n\n/*!  \\internal\n  \n  called by the scatter drawing function (\\ref drawScatterPlot) to draw the error bars on one data\n  point. \\a x and \\a y pixel positions of the data point are passed since they are already known in\n  pixel coordinates in the drawing function, so we save some extra coordToPixel transforms here. \\a\n  data is therefore only used for the errors, not key and value.\n*/\nvoid QCPGraph::drawError(QCPPainter *painter, double x, double y, const QCPData &data) const\n{\n  QCPAxis *keyAxis = mKeyAxis.data();\n  QCPAxis *valueAxis = mValueAxis.data();\n  if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << \"invalid key or value axis\"; return; }\n  \n  double a, b; // positions of error bar bounds in pixels\n  double barWidthHalf = mErrorBarSize*0.5;\n  double skipSymbolMargin = mScatterStyle.size(); // pixels left blank per side, when mErrorBarSkipSymbol is true\n\n  if (keyAxis->orientation() == Qt::Vertical)\n  {\n    // draw key error vertically and value error horizontally\n    if (mErrorType == etKey || mErrorType == etBoth)\n    {\n      a = keyAxis->coordToPixel(data.key-data.keyErrorMinus);\n      b = keyAxis->coordToPixel(data.key+data.keyErrorPlus);\n      if (keyAxis->rangeReversed())\n        qSwap(a,b);\n      // draw spine:\n      if (mErrorBarSkipSymbol)\n      {\n        if (a-y > skipSymbolMargin) // don't draw spine if error is so small it's within skipSymbolmargin\n          painter->drawLine(QLineF(x, a, x, y+skipSymbolMargin));\n        if (y-b > skipSymbolMargin)\n          painter->drawLine(QLineF(x, y-skipSymbolMargin, x, b));\n      } else\n        painter->drawLine(QLineF(x, a, x, b));\n      // draw handles:\n      painter->drawLine(QLineF(x-barWidthHalf, a, x+barWidthHalf, a));\n      painter->drawLine(QLineF(x-barWidthHalf, b, x+barWidthHalf, b));\n    }\n    if (mErrorType == etValue || mErrorType == etBoth)\n    {\n      a = valueAxis->coordToPixel(data.value-data.valueErrorMinus);\n      b = valueAxis->coordToPixel(data.value+data.valueErrorPlus);\n      if (valueAxis->rangeReversed())\n        qSwap(a,b);\n      // draw spine:\n      if (mErrorBarSkipSymbol)\n      {\n        if (x-a > skipSymbolMargin) // don't draw spine if error is so small it's within skipSymbolmargin\n          painter->drawLine(QLineF(a, y, x-skipSymbolMargin, y));\n        if (b-x > skipSymbolMargin)\n          painter->drawLine(QLineF(x+skipSymbolMargin, y, b, y));\n      } else\n        painter->drawLine(QLineF(a, y, b, y));\n      // draw handles:\n      painter->drawLine(QLineF(a, y-barWidthHalf, a, y+barWidthHalf));\n      painter->drawLine(QLineF(b, y-barWidthHalf, b, y+barWidthHalf));\n    }\n  } else // mKeyAxis->orientation() is Qt::Horizontal\n  {\n    // draw value error vertically and key error horizontally\n    if (mErrorType == etKey || mErrorType == etBoth)\n    {\n      a = keyAxis->coordToPixel(data.key-data.keyErrorMinus);\n      b = keyAxis->coordToPixel(data.key+data.keyErrorPlus);\n      if (keyAxis->rangeReversed())\n        qSwap(a,b);\n      // draw spine:\n      if (mErrorBarSkipSymbol)\n      {\n        if (x-a > skipSymbolMargin) // don't draw spine if error is so small it's within skipSymbolmargin\n          painter->drawLine(QLineF(a, y, x-skipSymbolMargin, y));\n        if (b-x > skipSymbolMargin)\n          painter->drawLine(QLineF(x+skipSymbolMargin, y, b, y));\n      } else\n        painter->drawLine(QLineF(a, y, b, y));\n      // draw handles:\n      painter->drawLine(QLineF(a, y-barWidthHalf, a, y+barWidthHalf));\n      painter->drawLine(QLineF(b, y-barWidthHalf, b, y+barWidthHalf));\n    }\n    if (mErrorType == etValue || mErrorType == etBoth)\n    {\n      a = valueAxis->coordToPixel(data.value-data.valueErrorMinus);\n      b = valueAxis->coordToPixel(data.value+data.valueErrorPlus);\n      if (valueAxis->rangeReversed())\n        qSwap(a,b);\n      // draw spine:\n      if (mErrorBarSkipSymbol)\n      {\n        if (a-y > skipSymbolMargin) // don't draw spine if error is so small it's within skipSymbolmargin\n          painter->drawLine(QLineF(x, a, x, y+skipSymbolMargin));\n        if (y-b > skipSymbolMargin)\n          painter->drawLine(QLineF(x, y-skipSymbolMargin, x, b));\n      } else\n        painter->drawLine(QLineF(x, a, x, b));\n      // draw handles:\n      painter->drawLine(QLineF(x-barWidthHalf, a, x+barWidthHalf, a));\n      painter->drawLine(QLineF(x-barWidthHalf, b, x+barWidthHalf, b));\n    }\n  }\n}\n\n/*!  \\internal\n  \n  called by \\ref getPreparedData to determine which data (key) range is visible at the current key\n  axis range setting, so only that needs to be processed.\n  \n  \\a lower returns an iterator to the lowest data point that needs to be taken into account when\n  plotting. Note that in order to get a clean plot all the way to the edge of the axis rect, \\a\n  lower may still be just outside the visible range.\n  \n  \\a upper returns an iterator to the highest data point. Same as before, \\a upper may also lie\n  just outside of the visible range.\n  \n  if the graph contains no data, both \\a lower and \\a upper point to constEnd.\n*/\nvoid QCPGraph::getVisibleDataBounds(QCPDataMap::const_iterator &lower, QCPDataMap::const_iterator &upper) const\n{\n  if (!mKeyAxis) { qDebug() << Q_FUNC_INFO << \"invalid key axis\"; return; }\n  if (mData->isEmpty())\n  {\n    lower = mData->constEnd();\n    upper = mData->constEnd();\n    return;\n  }\n  \n  // get visible data range as QMap iterators\n  QCPDataMap::const_iterator lbound = mData->lowerBound(mKeyAxis.data()->range().lower);\n  QCPDataMap::const_iterator ubound = mData->upperBound(mKeyAxis.data()->range().upper);\n  bool lowoutlier = lbound != mData->constBegin(); // indicates whether there exist points below axis range\n  bool highoutlier = ubound != mData->constEnd(); // indicates whether there exist points above axis range\n  \n  lower = (lowoutlier ? lbound-1 : lbound); // data point range that will be actually drawn\n  upper = (highoutlier ? ubound : ubound-1); // data point range that will be actually drawn\n}\n\n/*!  \\internal\n  \n  Counts the number of data points between \\a lower and \\a upper (including them), up to a maximum\n  of \\a maxCount.\n  \n  This function is used by \\ref getPreparedData to determine whether adaptive sampling shall be\n  used (if enabled via \\ref setAdaptiveSampling) or not. This is also why counting of data points\n  only needs to be done until \\a maxCount is reached, which should be set to the number of data\n  points at which adaptive sampling sets in.\n*/\nint QCPGraph::countDataInBounds(const QCPDataMap::const_iterator &lower, const QCPDataMap::const_iterator &upper, int maxCount) const\n{\n  if (upper == mData->constEnd() && lower == mData->constEnd())\n    return 0;\n  QCPDataMap::const_iterator it = lower;\n  int count = 1;\n  while (it != upper && count < maxCount)\n  {\n    ++it;\n    ++count;\n  }\n  return count;\n}\n\n/*! \\internal\n  \n  The line data vector generated by e.g. getLinePlotData contains only the line that connects the\n  data points. If the graph needs to be filled, two additional points need to be added at the\n  value-zero-line in the lower and upper key positions of the graph. This function calculates these\n  points and adds them to the end of \\a lineData. Since the fill is typically drawn before the line\n  stroke, these added points need to be removed again after the fill is done, with the\n  removeFillBasePoints function.\n  \n  The expanding of \\a lineData by two points will not cause unnecessary memory reallocations,\n  because the data vector generation functions (getLinePlotData etc.) reserve two extra points when\n  they allocate memory for \\a lineData.\n  \n  \\see removeFillBasePoints, lowerFillBasePoint, upperFillBasePoint\n*/\nvoid QCPGraph::addFillBasePoints(QVector<QPointF> *lineData) const\n{\n  if (!mKeyAxis) { qDebug() << Q_FUNC_INFO << \"invalid key axis\"; return; }\n  \n  // append points that close the polygon fill at the key axis:\n  if (mKeyAxis.data()->orientation() == Qt::Vertical)\n  {\n    *lineData << upperFillBasePoint(lineData->last().y());\n    *lineData << lowerFillBasePoint(lineData->first().y());\n  } else\n  {\n    *lineData << upperFillBasePoint(lineData->last().x());\n    *lineData << lowerFillBasePoint(lineData->first().x());\n  }\n}\n\n/*! \\internal\n  \n  removes the two points from \\a lineData that were added by \\ref addFillBasePoints.\n  \n  \\see addFillBasePoints, lowerFillBasePoint, upperFillBasePoint\n*/\nvoid QCPGraph::removeFillBasePoints(QVector<QPointF> *lineData) const\n{\n  lineData->remove(lineData->size()-2, 2);\n}\n\n/*! \\internal\n  \n  called by \\ref addFillBasePoints to conveniently assign the point which closes the fill polygon\n  on the lower side of the zero-value-line parallel to the key axis. The logarithmic axis scale\n  case is a bit special, since the zero-value-line in pixel coordinates is in positive or negative\n  infinity. So this case is handled separately by just closing the fill polygon on the axis which\n  lies in the direction towards the zero value.\n  \n  \\a lowerKey will be the the key (in pixels) of the returned point. Depending on whether the key\n  axis is horizontal or vertical, \\a lowerKey will end up as the x or y value of the returned\n  point, respectively.\n  \n  \\see upperFillBasePoint, addFillBasePoints\n*/\nQPointF QCPGraph::lowerFillBasePoint(double lowerKey) const\n{\n  QCPAxis *keyAxis = mKeyAxis.data();\n  QCPAxis *valueAxis = mValueAxis.data();\n  if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << \"invalid key or value axis\"; return QPointF(); }\n  \n  QPointF point;\n  if (valueAxis->scaleType() == QCPAxis::stLinear)\n  {\n    if (keyAxis->axisType() == QCPAxis::atLeft)\n    {\n      point.setX(valueAxis->coordToPixel(0));\n      point.setY(lowerKey);\n    } else if (keyAxis->axisType() == QCPAxis::atRight)\n    {\n      point.setX(valueAxis->coordToPixel(0));\n      point.setY(lowerKey);\n    } else if (keyAxis->axisType() == QCPAxis::atTop)\n    {\n      point.setX(lowerKey);\n      point.setY(valueAxis->coordToPixel(0));\n    } else if (keyAxis->axisType() == QCPAxis::atBottom)\n    {\n      point.setX(lowerKey);\n      point.setY(valueAxis->coordToPixel(0));\n    }\n  } else // valueAxis->mScaleType == QCPAxis::stLogarithmic\n  {\n    // In logarithmic scaling we can't just draw to value zero so we just fill all the way\n    // to the axis which is in the direction towards zero\n    if (keyAxis->orientation() == Qt::Vertical)\n    {\n      if ((valueAxis->range().upper < 0 && !valueAxis->rangeReversed()) ||\n          (valueAxis->range().upper > 0 && valueAxis->rangeReversed())) // if range is negative, zero is on opposite side of key axis\n        point.setX(keyAxis->axisRect()->right());\n      else\n        point.setX(keyAxis->axisRect()->left());\n      point.setY(lowerKey);\n    } else if (keyAxis->axisType() == QCPAxis::atTop || keyAxis->axisType() == QCPAxis::atBottom)\n    {\n      point.setX(lowerKey);\n      if ((valueAxis->range().upper < 0 && !valueAxis->rangeReversed()) ||\n          (valueAxis->range().upper > 0 && valueAxis->rangeReversed())) // if range is negative, zero is on opposite side of key axis\n        point.setY(keyAxis->axisRect()->top());\n      else\n        point.setY(keyAxis->axisRect()->bottom());\n    }\n  }\n  return point;\n}\n\n/*! \\internal\n  \n  called by \\ref addFillBasePoints to conveniently assign the point which closes the fill\n  polygon on the upper side of the zero-value-line parallel to the key axis. The logarithmic axis\n  scale case is a bit special, since the zero-value-line in pixel coordinates is in positive or\n  negative infinity. So this case is handled separately by just closing the fill polygon on the\n  axis which lies in the direction towards the zero value.\n\n  \\a upperKey will be the the key (in pixels) of the returned point. Depending on whether the key\n  axis is horizontal or vertical, \\a upperKey will end up as the x or y value of the returned\n  point, respectively.\n  \n  \\see lowerFillBasePoint, addFillBasePoints\n*/\nQPointF QCPGraph::upperFillBasePoint(double upperKey) const\n{\n  QCPAxis *keyAxis = mKeyAxis.data();\n  QCPAxis *valueAxis = mValueAxis.data();\n  if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << \"invalid key or value axis\"; return QPointF(); }\n  \n  QPointF point;\n  if (valueAxis->scaleType() == QCPAxis::stLinear)\n  {\n    if (keyAxis->axisType() == QCPAxis::atLeft)\n    {\n      point.setX(valueAxis->coordToPixel(0));\n      point.setY(upperKey);\n    } else if (keyAxis->axisType() == QCPAxis::atRight)\n    {\n      point.setX(valueAxis->coordToPixel(0));\n      point.setY(upperKey);\n    } else if (keyAxis->axisType() == QCPAxis::atTop)\n    {\n      point.setX(upperKey);\n      point.setY(valueAxis->coordToPixel(0));\n    } else if (keyAxis->axisType() == QCPAxis::atBottom)\n    {\n      point.setX(upperKey);\n      point.setY(valueAxis->coordToPixel(0));\n    }\n  } else // valueAxis->mScaleType == QCPAxis::stLogarithmic\n  {\n    // In logarithmic scaling we can't just draw to value 0 so we just fill all the way\n    // to the axis which is in the direction towards 0\n    if (keyAxis->orientation() == Qt::Vertical)\n    {\n      if ((valueAxis->range().upper < 0 && !valueAxis->rangeReversed()) ||\n          (valueAxis->range().upper > 0 && valueAxis->rangeReversed())) // if range is negative, zero is on opposite side of key axis\n        point.setX(keyAxis->axisRect()->right());\n      else\n        point.setX(keyAxis->axisRect()->left());\n      point.setY(upperKey);\n    } else if (keyAxis->axisType() == QCPAxis::atTop || keyAxis->axisType() == QCPAxis::atBottom)\n    {\n      point.setX(upperKey);\n      if ((valueAxis->range().upper < 0 && !valueAxis->rangeReversed()) ||\n          (valueAxis->range().upper > 0 && valueAxis->rangeReversed())) // if range is negative, zero is on opposite side of key axis\n        point.setY(keyAxis->axisRect()->top());\n      else\n        point.setY(keyAxis->axisRect()->bottom());\n    }\n  }\n  return point;\n}\n\n/*! \\internal\n  \n  Generates the polygon needed for drawing channel fills between this graph (data passed via \\a\n  lineData) and the graph specified by mChannelFillGraph (data generated by calling its \\ref\n  getPlotData function). May return an empty polygon if the key ranges have no overlap or fill\n  target graph and this graph don't have same orientation (i.e. both key axes horizontal or both\n  key axes vertical). For increased performance (due to implicit sharing), keep the returned\n  QPolygonF const.\n*/\nconst QPolygonF QCPGraph::getChannelFillPolygon(const QVector<QPointF> *lineData) const\n{\n  if (!mChannelFillGraph)\n    return QPolygonF();\n  \n  QCPAxis *keyAxis = mKeyAxis.data();\n  QCPAxis *valueAxis = mValueAxis.data();\n  if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << \"invalid key or value axis\"; return QPolygonF(); }\n  if (!mChannelFillGraph.data()->mKeyAxis) { qDebug() << Q_FUNC_INFO << \"channel fill target key axis invalid\"; return QPolygonF(); }\n  \n  if (mChannelFillGraph.data()->mKeyAxis.data()->orientation() != keyAxis->orientation())\n    return QPolygonF(); // don't have same axis orientation, can't fill that (Note: if keyAxis fits, valueAxis will fit too, because it's always orthogonal to keyAxis)\n  \n  if (lineData->isEmpty()) return QPolygonF();\n  QVector<QPointF> otherData;\n  mChannelFillGraph.data()->getPlotData(&otherData, 0);\n  if (otherData.isEmpty()) return QPolygonF();\n  QVector<QPointF> thisData;\n  thisData.reserve(lineData->size()+otherData.size()); // because we will join both vectors at end of this function\n  for (int i=0; i<lineData->size(); ++i) // don't use the vector<<(vector),  it squeezes internally, which ruins the performance tuning with reserve()\n    thisData << lineData->at(i);\n  \n  // pointers to be able to swap them, depending which data range needs cropping:\n  QVector<QPointF> *staticData = &thisData;\n  QVector<QPointF> *croppedData = &otherData;\n  \n  // crop both vectors to ranges in which the keys overlap (which coord is key, depends on axisType):\n  if (keyAxis->orientation() == Qt::Horizontal)\n  {\n    // x is key\n    // if an axis range is reversed, the data point keys will be descending. Reverse them, since following algorithm assumes ascending keys:\n    if (staticData->first().x() > staticData->last().x())\n    {\n      int size = staticData->size();\n      for (int i=0; i<size/2; ++i)\n        qSwap((*staticData)[i], (*staticData)[size-1-i]);\n    }\n    if (croppedData->first().x() > croppedData->last().x())\n    {\n      int size = croppedData->size();\n      for (int i=0; i<size/2; ++i)\n        qSwap((*croppedData)[i], (*croppedData)[size-1-i]);\n    }\n    // crop lower bound:\n    if (staticData->first().x() < croppedData->first().x()) // other one must be cropped\n      qSwap(staticData, croppedData);\n    int lowBound = findIndexBelowX(croppedData, staticData->first().x());\n    if (lowBound == -1) return QPolygonF(); // key ranges have no overlap\n    croppedData->remove(0, lowBound);\n    // set lowest point of cropped data to fit exactly key position of first static data\n    // point via linear interpolation:\n    if (croppedData->size() < 2) return QPolygonF(); // need at least two points for interpolation\n    double slope;\n    if (croppedData->at(1).x()-croppedData->at(0).x() != 0)\n      slope = (croppedData->at(1).y()-croppedData->at(0).y())/(croppedData->at(1).x()-croppedData->at(0).x());\n    else\n      slope = 0;\n    (*croppedData)[0].setY(croppedData->at(0).y()+slope*(staticData->first().x()-croppedData->at(0).x()));\n    (*croppedData)[0].setX(staticData->first().x());\n    \n    // crop upper bound:\n    if (staticData->last().x() > croppedData->last().x()) // other one must be cropped\n      qSwap(staticData, croppedData);\n    int highBound = findIndexAboveX(croppedData, staticData->last().x());\n    if (highBound == -1) return QPolygonF(); // key ranges have no overlap\n    croppedData->remove(highBound+1, croppedData->size()-(highBound+1));\n    // set highest point of cropped data to fit exactly key position of last static data\n    // point via linear interpolation:\n    if (croppedData->size() < 2) return QPolygonF(); // need at least two points for interpolation\n    int li = croppedData->size()-1; // last index\n    if (croppedData->at(li).x()-croppedData->at(li-1).x() != 0)\n      slope = (croppedData->at(li).y()-croppedData->at(li-1).y())/(croppedData->at(li).x()-croppedData->at(li-1).x());\n    else\n      slope = 0;\n    (*croppedData)[li].setY(croppedData->at(li-1).y()+slope*(staticData->last().x()-croppedData->at(li-1).x()));\n    (*croppedData)[li].setX(staticData->last().x());\n  } else // mKeyAxis->orientation() == Qt::Vertical\n  {\n    // y is key\n    // similar to \"x is key\" but switched x,y. Further, lower/upper meaning is inverted compared to x,\n    // because in pixel coordinates, y increases from top to bottom, not bottom to top like data coordinate.\n    // if an axis range is reversed, the data point keys will be descending. Reverse them, since following algorithm assumes ascending keys:\n    if (staticData->first().y() < staticData->last().y())\n    {\n      int size = staticData->size();\n      for (int i=0; i<size/2; ++i)\n        qSwap((*staticData)[i], (*staticData)[size-1-i]);\n    }\n    if (croppedData->first().y() < croppedData->last().y())\n    {\n      int size = croppedData->size();\n      for (int i=0; i<size/2; ++i)\n        qSwap((*croppedData)[i], (*croppedData)[size-1-i]);\n    }\n    // crop lower bound:\n    if (staticData->first().y() > croppedData->first().y()) // other one must be cropped\n      qSwap(staticData, croppedData);\n    int lowBound = findIndexAboveY(croppedData, staticData->first().y());\n    if (lowBound == -1) return QPolygonF(); // key ranges have no overlap\n    croppedData->remove(0, lowBound);\n    // set lowest point of cropped data to fit exactly key position of first static data\n    // point via linear interpolation:\n    if (croppedData->size() < 2) return QPolygonF(); // need at least two points for interpolation\n    double slope;\n    if (croppedData->at(1).y()-croppedData->at(0).y() != 0) // avoid division by zero in step plots\n      slope = (croppedData->at(1).x()-croppedData->at(0).x())/(croppedData->at(1).y()-croppedData->at(0).y());\n    else\n      slope = 0;\n    (*croppedData)[0].setX(croppedData->at(0).x()+slope*(staticData->first().y()-croppedData->at(0).y()));\n    (*croppedData)[0].setY(staticData->first().y());\n    \n    // crop upper bound:\n    if (staticData->last().y() < croppedData->last().y()) // other one must be cropped\n      qSwap(staticData, croppedData);\n    int highBound = findIndexBelowY(croppedData, staticData->last().y());\n    if (highBound == -1) return QPolygonF(); // key ranges have no overlap\n    croppedData->remove(highBound+1, croppedData->size()-(highBound+1));\n    // set highest point of cropped data to fit exactly key position of last static data\n    // point via linear interpolation:\n    if (croppedData->size() < 2) return QPolygonF(); // need at least two points for interpolation\n    int li = croppedData->size()-1; // last index\n    if (croppedData->at(li).y()-croppedData->at(li-1).y() != 0) // avoid division by zero in step plots\n      slope = (croppedData->at(li).x()-croppedData->at(li-1).x())/(croppedData->at(li).y()-croppedData->at(li-1).y());\n    else\n      slope = 0;\n    (*croppedData)[li].setX(croppedData->at(li-1).x()+slope*(staticData->last().y()-croppedData->at(li-1).y()));\n    (*croppedData)[li].setY(staticData->last().y());\n  }\n  \n  // return joined:\n  for (int i=otherData.size()-1; i>=0; --i) // insert reversed, otherwise the polygon will be twisted\n    thisData << otherData.at(i);\n  return QPolygonF(thisData);\n}\n\n/*! \\internal\n  \n  Finds the smallest index of \\a data, whose points x value is just above \\a x. Assumes x values in\n  \\a data points are ordered ascending, as is the case when plotting with horizontal key axis.\n\n  Used to calculate the channel fill polygon, see \\ref getChannelFillPolygon.\n*/\nint QCPGraph::findIndexAboveX(const QVector<QPointF> *data, double x) const\n{\n  for (int i=data->size()-1; i>=0; --i)\n  {\n    if (data->at(i).x() < x)\n    {\n      if (i<data->size()-1)\n        return i+1;\n      else\n        return data->size()-1;\n    }\n  }\n  return -1;\n}\n\n/*! \\internal\n  \n  Finds the highest index of \\a data, whose points x value is just below \\a x. Assumes x values in\n  \\a data points are ordered ascending, as is the case when plotting with horizontal key axis.\n  \n  Used to calculate the channel fill polygon, see \\ref getChannelFillPolygon.\n*/\nint QCPGraph::findIndexBelowX(const QVector<QPointF> *data, double x) const\n{\n  for (int i=0; i<data->size(); ++i)\n  {\n    if (data->at(i).x() > x)\n    {\n      if (i>0)\n        return i-1;\n      else\n        return 0;\n    }\n  }\n  return -1;\n}\n\n/*! \\internal\n  \n  Finds the smallest index of \\a data, whose points y value is just above \\a y. Assumes y values in\n  \\a data points are ordered descending, as is the case when plotting with vertical key axis.\n  \n  Used to calculate the channel fill polygon, see \\ref getChannelFillPolygon.\n*/\nint QCPGraph::findIndexAboveY(const QVector<QPointF> *data, double y) const\n{\n  for (int i=0; i<data->size(); ++i)\n  {\n    if (data->at(i).y() < y)\n    {\n      if (i>0)\n        return i-1;\n      else\n        return 0;\n    }\n  }\n  return -1;\n}\n\n/*! \\internal\n  \n  Calculates the (minimum) distance (in pixels) the graph's representation has from the given \\a\n  pixelPoint in pixels. This is used to determine whether the graph was clicked or not, e.g. in\n  \\ref selectTest.\n  \n  If either the graph has no data or if the line style is \\ref lsNone and the scatter style's shape\n  is \\ref QCPScatterStyle::ssNone (i.e. there is no visual representation of the graph), returns\n  500.\n*/\ndouble QCPGraph::pointDistance(const QPointF &pixelPoint) const\n{\n  if (mData->isEmpty())\n  {\n    qDebug() << Q_FUNC_INFO << \"requested point distance on graph\" << mName << \"without data\";\n    return 500;\n  }\n  if (mData->size() == 1)\n  {\n    QPointF dataPoint = coordsToPixels(mData->constBegin().key(), mData->constBegin().value().value);\n    return QVector2D(dataPoint-pixelPoint).length();\n  }\n  \n  if (mLineStyle == lsNone && mScatterStyle.isNone())\n    return 500;\n  \n  // calculate minimum distances to graph representation:\n  if (mLineStyle == lsNone)\n  {\n    // no line displayed, only calculate distance to scatter points:\n    QVector<QCPData> *scatterData = new QVector<QCPData>;\n    getScatterPlotData(scatterData);\n    double minDistSqr = std::numeric_limits<double>::max();\n    QPointF ptA;\n    QPointF ptB = coordsToPixels(scatterData->at(0).key, scatterData->at(0).value); // getScatterPlotData returns in plot coordinates, so transform to pixels\n    for (int i=1; i<scatterData->size(); ++i)\n    {\n      ptA = ptB;\n      ptB = coordsToPixels(scatterData->at(i).key, scatterData->at(i).value);\n      double currentDistSqr = distSqrToLine(ptA, ptB, pixelPoint);\n      if (currentDistSqr < minDistSqr)\n        minDistSqr = currentDistSqr;\n    }\n    delete scatterData;\n    return sqrt(minDistSqr);\n  } else\n  {\n    // line displayed calculate distance to line segments:\n    QVector<QPointF> *lineData = new QVector<QPointF>;\n    getPlotData(lineData, 0); // unlike with getScatterPlotData we get pixel coordinates here\n    double minDistSqr = std::numeric_limits<double>::max();\n    if (mLineStyle == lsImpulse)\n    {\n      // impulse plot differs from other line styles in that the lineData points are only pairwise connected:\n      for (int i=0; i<lineData->size()-1; i+=2) // iterate pairs\n      {\n        double currentDistSqr = distSqrToLine(lineData->at(i), lineData->at(i+1), pixelPoint);\n        if (currentDistSqr < minDistSqr)\n          minDistSqr = currentDistSqr;\n      }\n    } else\n    {\n      // all other line plots (line and step) connect points directly:\n      for (int i=0; i<lineData->size()-1; ++i)\n      {\n        double currentDistSqr = distSqrToLine(lineData->at(i), lineData->at(i+1), pixelPoint);\n        if (currentDistSqr < minDistSqr)\n          minDistSqr = currentDistSqr;\n      }\n    }\n    delete lineData;\n    return sqrt(minDistSqr);\n  }\n}\n\n/*! \\internal\n  \n  Finds the highest index of \\a data, whose points y value is just below \\a y. Assumes y values in\n  \\a data points are ordered descending, as is the case when plotting with vertical key axis (since\n  keys are ordered ascending).\n\n  Used to calculate the channel fill polygon, see \\ref getChannelFillPolygon.\n*/\nint QCPGraph::findIndexBelowY(const QVector<QPointF> *data, double y) const\n{\n  for (int i=data->size()-1; i>=0; --i)\n  {\n    if (data->at(i).y() > y)\n    {\n      if (i<data->size()-1)\n        return i+1;\n      else\n        return data->size()-1;\n    }\n  }\n  return -1;\n}\n\n/* inherits documentation from base class */\nQCPRange QCPGraph::getKeyRange(bool &foundRange, SignDomain inSignDomain) const\n{\n  // just call the specialized version which takes an additional argument whether error bars\n  // should also be taken into consideration for range calculation. We set this to true here.\n  return getKeyRange(foundRange, inSignDomain, true);\n}\n\n/* inherits documentation from base class */\nQCPRange QCPGraph::getValueRange(bool &foundRange, SignDomain inSignDomain) const\n{\n  // just call the specialized version which takes an additional argument whether error bars\n  // should also be taken into consideration for range calculation. We set this to true here.\n  return getValueRange(foundRange, inSignDomain, true);\n}\n\n/*! \\overload\n  \n  Allows to specify whether the error bars should be included in the range calculation.\n  \n  \\see getKeyRange(bool &foundRange, SignDomain inSignDomain)\n*/\nQCPRange QCPGraph::getKeyRange(bool &foundRange, SignDomain inSignDomain, bool includeErrors) const\n{\n  QCPRange range;\n  bool haveLower = false;\n  bool haveUpper = false;\n  \n  double current, currentErrorMinus, currentErrorPlus;\n  \n  if (inSignDomain == sdBoth) // range may be anywhere\n  {\n    QCPDataMap::const_iterator it = mData->constBegin();\n    while (it != mData->constEnd())\n    {\n      current = it.value().key;\n      currentErrorMinus = (includeErrors ? it.value().keyErrorMinus : 0);\n      currentErrorPlus = (includeErrors ? it.value().keyErrorPlus : 0);\n      if (current-currentErrorMinus < range.lower || !haveLower)\n      {\n        range.lower = current-currentErrorMinus;\n        haveLower = true;\n      }\n      if (current+currentErrorPlus > range.upper || !haveUpper)\n      {\n        range.upper = current+currentErrorPlus;\n        haveUpper = true;\n      }\n      ++it;\n    }\n  } else if (inSignDomain == sdNegative) // range may only be in the negative sign domain\n  {\n    QCPDataMap::const_iterator it = mData->constBegin();\n    while (it != mData->constEnd())\n    {\n      current = it.value().key;\n      currentErrorMinus = (includeErrors ? it.value().keyErrorMinus : 0);\n      currentErrorPlus = (includeErrors ? it.value().keyErrorPlus : 0);\n      if ((current-currentErrorMinus < range.lower || !haveLower) && current-currentErrorMinus < 0)\n      {\n        range.lower = current-currentErrorMinus;\n        haveLower = true;\n      }\n      if ((current+currentErrorPlus > range.upper || !haveUpper) && current+currentErrorPlus < 0)\n      {\n        range.upper = current+currentErrorPlus;\n        haveUpper = true;\n      }\n      if (includeErrors) // in case point is in valid sign domain but errobars stretch beyond it, we still want to geht that point.\n      {\n        if ((current < range.lower || !haveLower) && current < 0)\n        {\n          range.lower = current;\n          haveLower = true;\n        }\n        if ((current > range.upper || !haveUpper) && current < 0)\n        {\n          range.upper = current;\n          haveUpper = true;\n        }\n      }\n      ++it;\n    }\n  } else if (inSignDomain == sdPositive) // range may only be in the positive sign domain\n  {\n    QCPDataMap::const_iterator it = mData->constBegin();\n    while (it != mData->constEnd())\n    {\n      current = it.value().key;\n      currentErrorMinus = (includeErrors ? it.value().keyErrorMinus : 0);\n      currentErrorPlus = (includeErrors ? it.value().keyErrorPlus : 0);\n      if ((current-currentErrorMinus < range.lower || !haveLower) && current-currentErrorMinus > 0)\n      {\n        range.lower = current-currentErrorMinus;\n        haveLower = true;\n      }\n      if ((current+currentErrorPlus > range.upper || !haveUpper) && current+currentErrorPlus > 0)\n      {\n        range.upper = current+currentErrorPlus;\n        haveUpper = true;\n      }\n      if (includeErrors) // in case point is in valid sign domain but errobars stretch beyond it, we still want to get that point.\n      {\n        if ((current < range.lower || !haveLower) && current > 0)\n        {\n          range.lower = current;\n          haveLower = true;\n        }\n        if ((current > range.upper || !haveUpper) && current > 0)\n        {\n          range.upper = current;\n          haveUpper = true;\n        }\n      }\n      ++it;\n    }\n  }\n  \n  foundRange = haveLower && haveUpper;\n  return range;\n}\n\n/*! \\overload\n  \n  Allows to specify whether the error bars should be included in the range calculation.\n  \n  \\see getValueRange(bool &foundRange, SignDomain inSignDomain)\n*/\nQCPRange QCPGraph::getValueRange(bool &foundRange, SignDomain inSignDomain, bool includeErrors) const\n{\n  QCPRange range;\n  bool haveLower = false;\n  bool haveUpper = false;\n  \n  double current, currentErrorMinus, currentErrorPlus;\n  \n  if (inSignDomain == sdBoth) // range may be anywhere\n  {\n    QCPDataMap::const_iterator it = mData->constBegin();\n    while (it != mData->constEnd())\n    {\n      current = it.value().value;\n      currentErrorMinus = (includeErrors ? it.value().valueErrorMinus : 0);\n      currentErrorPlus = (includeErrors ? it.value().valueErrorPlus : 0);\n      if (current-currentErrorMinus < range.lower || !haveLower)\n      {\n        range.lower = current-currentErrorMinus;\n        haveLower = true;\n      }\n      if (current+currentErrorPlus > range.upper || !haveUpper)\n      {\n        range.upper = current+currentErrorPlus;\n        haveUpper = true;\n      }\n      ++it;\n    }\n  } else if (inSignDomain == sdNegative) // range may only be in the negative sign domain\n  {\n    QCPDataMap::const_iterator it = mData->constBegin();\n    while (it != mData->constEnd())\n    {\n      current = it.value().value;\n      currentErrorMinus = (includeErrors ? it.value().valueErrorMinus : 0);\n      currentErrorPlus = (includeErrors ? it.value().valueErrorPlus : 0);\n      if ((current-currentErrorMinus < range.lower || !haveLower) && current-currentErrorMinus < 0)\n      {\n        range.lower = current-currentErrorMinus;\n        haveLower = true;\n      }\n      if ((current+currentErrorPlus > range.upper || !haveUpper) && current+currentErrorPlus < 0)\n      {\n        range.upper = current+currentErrorPlus;\n        haveUpper = true;\n      }\n      if (includeErrors) // in case point is in valid sign domain but errobars stretch beyond it, we still want to get that point.\n      {\n        if ((current < range.lower || !haveLower) && current < 0)\n        {\n          range.lower = current;\n          haveLower = true;\n        }\n        if ((current > range.upper || !haveUpper) && current < 0)\n        {\n          range.upper = current;\n          haveUpper = true;\n        }\n      }\n      ++it;\n    }\n  } else if (inSignDomain == sdPositive) // range may only be in the positive sign domain\n  {\n    QCPDataMap::const_iterator it = mData->constBegin();\n    while (it != mData->constEnd())\n    {\n      current = it.value().value;\n      currentErrorMinus = (includeErrors ? it.value().valueErrorMinus : 0);\n      currentErrorPlus = (includeErrors ? it.value().valueErrorPlus : 0);\n      if ((current-currentErrorMinus < range.lower || !haveLower) && current-currentErrorMinus > 0)\n      {\n        range.lower = current-currentErrorMinus;\n        haveLower = true;\n      }\n      if ((current+currentErrorPlus > range.upper || !haveUpper) && current+currentErrorPlus > 0)\n      {\n        range.upper = current+currentErrorPlus;\n        haveUpper = true;\n      }\n      if (includeErrors) // in case point is in valid sign domain but errobars stretch beyond it, we still want to geht that point.\n      {\n        if ((current < range.lower || !haveLower) && current > 0)\n        {\n          range.lower = current;\n          haveLower = true;\n        }\n        if ((current > range.upper || !haveUpper) && current > 0)\n        {\n          range.upper = current;\n          haveUpper = true;\n        }\n      }\n      ++it;\n    }\n  }\n  \n  foundRange = haveLower && haveUpper;\n  return range;\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPCurveData\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPCurveData\n  \\brief Holds the data of one single data point for QCPCurve.\n  \n  The container for storing multiple data points is \\ref QCPCurveDataMap.\n  \n  The stored data is:\n  \\li \\a t: the free parameter of the curve at this curve point (cp. the mathematical vector <em>(x(t), y(t))</em>)\n  \\li \\a key: coordinate on the key axis of this curve point\n  \\li \\a value: coordinate on the value axis of this curve point\n  \n  \\see QCPCurveDataMap\n*/\n\n/*!\n  Constructs a curve data point with t, key and value set to zero.\n*/\nQCPCurveData::QCPCurveData() :\n  t(0),\n  key(0),\n  value(0)\n{\n}\n\n/*!\n  Constructs a curve data point with the specified \\a t, \\a key and \\a value.\n*/\nQCPCurveData::QCPCurveData(double t, double key, double value) :\n  t(t),\n  key(key),\n  value(value)\n{\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPCurve\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPCurve\n  \\brief A plottable representing a parametric curve in a plot.\n  \n  \\image html QCPCurve.png\n  \n  Unlike QCPGraph, plottables of this type may have multiple points with the same key coordinate,\n  so their visual representation can have \\a loops. This is realized by introducing a third\n  coordinate \\a t, which defines the order of the points described by the other two coordinates \\a\n  x and \\a y.\n\n  To plot data, assign it with the \\ref setData or \\ref addData functions.\n  \n  \\section appearance Changing the appearance\n  \n  The appearance of the curve is determined by the pen and the brush (\\ref setPen, \\ref setBrush).\n  \\section usage Usage\n  \n  Like all data representing objects in QCustomPlot, the QCPCurve is a plottable (QCPAbstractPlottable). So\n  the plottable-interface of QCustomPlot applies (QCustomPlot::plottable, QCustomPlot::addPlottable, QCustomPlot::removePlottable, etc.)\n  \n  Usually, you first create an instance:\n  \\code\n  QCPCurve *newCurve = new QCPCurve(customPlot->xAxis, customPlot->yAxis);\\endcode\n  add it to the customPlot with QCustomPlot::addPlottable:\n  \\code\n  customPlot->addPlottable(newCurve);\\endcode\n  and then modify the properties of the newly created plottable, e.g.:\n  \\code\n  newCurve->setName(\"Fermat's Spiral\");\n  newCurve->setData(tData, xData, yData);\\endcode\n*/\n\n/*!\n  Constructs a curve which uses \\a keyAxis as its key axis (\"x\") and \\a valueAxis as its value\n  axis (\"y\"). \\a keyAxis and \\a valueAxis must reside in the same QCustomPlot instance and not have\n  the same orientation. If either of these restrictions is violated, a corresponding message is\n  printed to the debug output (qDebug), the construction is not aborted, though.\n  \n  The constructed QCPCurve can be added to the plot with QCustomPlot::addPlottable, QCustomPlot\n  then takes ownership of the graph.\n*/\nQCPCurve::QCPCurve(QCPAxis *keyAxis, QCPAxis *valueAxis) :\n  QCPAbstractPlottable(keyAxis, valueAxis)\n{\n  mData = new QCPCurveDataMap;\n  mPen.setColor(Qt::blue);\n  mPen.setStyle(Qt::SolidLine);\n  mBrush.setColor(Qt::blue);\n  mBrush.setStyle(Qt::NoBrush);\n  mSelectedPen = mPen;\n  mSelectedPen.setWidthF(2.5);\n  mSelectedPen.setColor(QColor(80, 80, 255)); // lighter than Qt::blue of mPen\n  mSelectedBrush = mBrush;\n  \n  setScatterStyle(QCPScatterStyle());\n  setLineStyle(lsLine);\n}\n\nQCPCurve::~QCPCurve()\n{\n  delete mData;\n}\n\n/*!\n  Replaces the current data with the provided \\a data.\n  \n  If \\a copy is set to true, data points in \\a data will only be copied. if false, the plottable\n  takes ownership of the passed data and replaces the internal data pointer with it. This is\n  significantly faster than copying for large datasets.\n*/\nvoid QCPCurve::setData(QCPCurveDataMap *data, bool copy)\n{\n  if (copy)\n  {\n    *mData = *data;\n  } else\n  {\n    delete mData;\n    mData = data;\n  }\n}\n\n/*! \\overload\n  \n  Replaces the current data with the provided points in \\a t, \\a key and \\a value tuples. The\n  provided vectors should have equal length. Else, the number of added points will be the size of\n  the smallest vector.\n*/\nvoid QCPCurve::setData(const QVector<double> &t, const QVector<double> &key, const QVector<double> &value)\n{\n  mData->clear();\n  int n = t.size();\n  n = qMin(n, key.size());\n  n = qMin(n, value.size());\n  QCPCurveData newData;\n  for (int i=0; i<n; ++i)\n  {\n    newData.t = t[i];\n    newData.key = key[i];\n    newData.value = value[i];\n    mData->insertMulti(newData.t, newData);\n  }\n}\n\n/*! \\overload\n  \n  Replaces the current data with the provided \\a key and \\a value pairs. The t parameter\n  of each data point will be set to the integer index of the respective key/value pair.\n*/\nvoid QCPCurve::setData(const QVector<double> &key, const QVector<double> &value)\n{\n  mData->clear();\n  int n = key.size();\n  n = qMin(n, value.size());\n  QCPCurveData newData;\n  for (int i=0; i<n; ++i)\n  {\n    newData.t = i; // no t vector given, so we assign t the index of the key/value pair\n    newData.key = key[i];\n    newData.value = value[i];\n    mData->insertMulti(newData.t, newData);\n  }\n}\n\n/*!\n  Sets the visual appearance of single data points in the plot. If set to \\ref\n  QCPScatterStyle::ssNone, no scatter points are drawn (e.g. for line-only plots with appropriate\n  line style).\n  \n  \\see QCPScatterStyle, setLineStyle\n*/\nvoid QCPCurve::setScatterStyle(const QCPScatterStyle &style)\n{\n  mScatterStyle = style;\n}\n\n/*!\n  Sets how the single data points are connected in the plot or how they are represented visually\n  apart from the scatter symbol. For scatter-only plots, set \\a style to \\ref lsNone and \\ref\n  setScatterStyle to the desired scatter style.\n  \n  \\see setScatterStyle\n*/\nvoid QCPCurve::setLineStyle(QCPCurve::LineStyle style)\n{\n  mLineStyle = style;\n}\n\n/*!\n  Adds the provided data points in \\a dataMap to the current data.\n  \\see removeData\n*/\nvoid QCPCurve::addData(const QCPCurveDataMap &dataMap)\n{\n  mData->unite(dataMap);\n}\n\n/*! \\overload\n  Adds the provided single data point in \\a data to the current data.\n  \\see removeData\n*/\nvoid QCPCurve::addData(const QCPCurveData &data)\n{\n  mData->insertMulti(data.t, data);\n}\n\n/*! \\overload\n  Adds the provided single data point as \\a t, \\a key and \\a value tuple to the current data\n  \\see removeData\n*/\nvoid QCPCurve::addData(double t, double key, double value)\n{\n  QCPCurveData newData;\n  newData.t = t;\n  newData.key = key;\n  newData.value = value;\n  mData->insertMulti(newData.t, newData);\n}\n\n/*! \\overload\n  \n  Adds the provided single data point as \\a key and \\a value pair to the current data The t\n  parameter of the data point is set to the t of the last data point plus 1. If there is no last\n  data point, t will be set to 0.\n  \n  \\see removeData\n*/\nvoid QCPCurve::addData(double key, double value)\n{\n  QCPCurveData newData;\n  if (!mData->isEmpty())\n    newData.t = (mData->constEnd()-1).key()+1;\n  else\n    newData.t = 0;\n  newData.key = key;\n  newData.value = value;\n  mData->insertMulti(newData.t, newData);\n}\n\n/*! \\overload\n  Adds the provided data points as \\a t, \\a key and \\a value tuples to the current data.\n  \\see removeData\n*/\nvoid QCPCurve::addData(const QVector<double> &ts, const QVector<double> &keys, const QVector<double> &values)\n{\n  int n = ts.size();\n  n = qMin(n, keys.size());\n  n = qMin(n, values.size());\n  QCPCurveData newData;\n  for (int i=0; i<n; ++i)\n  {\n    newData.t = ts[i];\n    newData.key = keys[i];\n    newData.value = values[i];\n    mData->insertMulti(newData.t, newData);\n  }\n}\n\n/*!\n  Removes all data points with curve parameter t smaller than \\a t.\n  \\see addData, clearData\n*/\nvoid QCPCurve::removeDataBefore(double t)\n{\n  QCPCurveDataMap::iterator it = mData->begin();\n  while (it != mData->end() && it.key() < t)\n    it = mData->erase(it);\n}\n\n/*!\n  Removes all data points with curve parameter t greater than \\a t.\n  \\see addData, clearData\n*/\nvoid QCPCurve::removeDataAfter(double t)\n{\n  if (mData->isEmpty()) return;\n  QCPCurveDataMap::iterator it = mData->upperBound(t);\n  while (it != mData->end())\n    it = mData->erase(it);\n}\n\n/*!\n  Removes all data points with curve parameter t between \\a fromt and \\a tot. if \\a fromt is\n  greater or equal to \\a tot, the function does nothing. To remove a single data point with known\n  t, use \\ref removeData(double t).\n  \n  \\see addData, clearData\n*/\nvoid QCPCurve::removeData(double fromt, double tot)\n{\n  if (fromt >= tot || mData->isEmpty()) return;\n  QCPCurveDataMap::iterator it = mData->upperBound(fromt);\n  QCPCurveDataMap::iterator itEnd = mData->upperBound(tot);\n  while (it != itEnd)\n    it = mData->erase(it);\n}\n\n/*! \\overload\n  \n  Removes a single data point at curve parameter \\a t. If the position is not known with absolute\n  precision, consider using \\ref removeData(double fromt, double tot) with a small fuzziness\n  interval around the suspected position, depeding on the precision with which the curve parameter\n  is known.\n  \n  \\see addData, clearData\n*/\nvoid QCPCurve::removeData(double t)\n{\n  mData->remove(t);\n}\n\n/*!\n  Removes all data points.\n  \\see removeData, removeDataAfter, removeDataBefore\n*/\nvoid QCPCurve::clearData()\n{\n  mData->clear();\n}\n\n/* inherits documentation from base class */\ndouble QCPCurve::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const\n{\n  Q_UNUSED(details)\n  if ((onlySelectable && !mSelectable) || mData->isEmpty())\n    return -1;\n  if (!mKeyAxis || !mValueAxis) { qDebug() << Q_FUNC_INFO << \"invalid key or value axis\"; return -1; }\n  \n  if (mKeyAxis.data()->axisRect()->rect().contains(pos.toPoint()))\n    return pointDistance(pos);\n  else\n    return -1;\n}\n\n/* inherits documentation from base class */\nvoid QCPCurve::draw(QCPPainter *painter)\n{\n  if (mData->isEmpty()) return;\n  \n  // allocate line vector:\n  QVector<QPointF> *lineData = new QVector<QPointF>;\n  \n  // fill with curve data:\n  getCurveData(lineData);\n  \n  // check data validity if flag set:\n#ifdef QCUSTOMPLOT_CHECK_DATA\n  QCPCurveDataMap::const_iterator it;\n  for (it = mData->constBegin(); it != mData->constEnd(); ++it)\n  {\n    if (QCP::isInvalidData(it.value().t) ||\n        QCP::isInvalidData(it.value().key, it.value().value))\n      qDebug() << Q_FUNC_INFO << \"Data point at\" << it.key() << \"invalid.\" << \"Plottable name:\" << name();\n  }\n#endif\n  \n  // draw curve fill:\n  if (mainBrush().style() != Qt::NoBrush && mainBrush().color().alpha() != 0)\n  {\n    applyFillAntialiasingHint(painter);\n    painter->setPen(Qt::NoPen);\n    painter->setBrush(mainBrush());\n    painter->drawPolygon(QPolygonF(*lineData));\n  }\n  \n  // draw curve line:\n  if (mLineStyle != lsNone && mainPen().style() != Qt::NoPen && mainPen().color().alpha() != 0)\n  {\n    applyDefaultAntialiasingHint(painter);\n    painter->setPen(mainPen());\n    painter->setBrush(Qt::NoBrush);\n    // if drawing solid line and not in PDF, use much faster line drawing instead of polyline:\n    if (mParentPlot->plottingHints().testFlag(QCP::phFastPolylines) &&\n        painter->pen().style() == Qt::SolidLine &&\n        !painter->modes().testFlag(QCPPainter::pmVectorized) &&\n        !painter->modes().testFlag(QCPPainter::pmNoCaching))\n    {\n      for (int i=1; i<lineData->size(); ++i)\n        painter->drawLine(lineData->at(i-1), lineData->at(i));\n    } else\n    {\n      painter->drawPolyline(QPolygonF(*lineData));\n    }\n  }\n  \n  // draw scatters:\n  if (!mScatterStyle.isNone())\n    drawScatterPlot(painter, lineData);\n  \n  // free allocated line data:\n  delete lineData;\n}\n\n/* inherits documentation from base class */\nvoid QCPCurve::drawLegendIcon(QCPPainter *painter, const QRectF &rect) const\n{\n  // draw fill:\n  if (mBrush.style() != Qt::NoBrush)\n  {\n    applyFillAntialiasingHint(painter);\n    painter->fillRect(QRectF(rect.left(), rect.top()+rect.height()/2.0, rect.width(), rect.height()/3.0), mBrush);\n  }\n  // draw line vertically centered:\n  if (mLineStyle != lsNone)\n  {\n    applyDefaultAntialiasingHint(painter);\n    painter->setPen(mPen);\n    painter->drawLine(QLineF(rect.left(), rect.top()+rect.height()/2.0, rect.right()+5, rect.top()+rect.height()/2.0)); // +5 on x2 else last segment is missing from dashed/dotted pens\n  }\n  // draw scatter symbol:\n  if (!mScatterStyle.isNone())\n  {\n    applyScattersAntialiasingHint(painter);\n    // scale scatter pixmap if it's too large to fit in legend icon rect:\n    if (mScatterStyle.shape() == QCPScatterStyle::ssPixmap && (mScatterStyle.pixmap().size().width() > rect.width() || mScatterStyle.pixmap().size().height() > rect.height()))\n    {\n      QCPScatterStyle scaledStyle(mScatterStyle);\n      scaledStyle.setPixmap(scaledStyle.pixmap().scaled(rect.size().toSize(), Qt::KeepAspectRatio, Qt::SmoothTransformation));\n      scaledStyle.applyTo(painter, mPen);\n      scaledStyle.drawShape(painter, QRectF(rect).center());\n    } else\n    {\n      mScatterStyle.applyTo(painter, mPen);\n      mScatterStyle.drawShape(painter, QRectF(rect).center());\n    }\n  }\n}\n\n/*! \\internal\n  \n  Draws scatter symbols at every data point passed in \\a pointData. scatter symbols are independent of\n  the line style and are always drawn if scatter shape is not \\ref QCPScatterStyle::ssNone.\n*/\nvoid QCPCurve::drawScatterPlot(QCPPainter *painter, const QVector<QPointF> *pointData) const\n{\n  // draw scatter point symbols:\n  applyScattersAntialiasingHint(painter);\n  mScatterStyle.applyTo(painter, mPen);\n  for (int i=0; i<pointData->size(); ++i)\n    mScatterStyle.drawShape(painter,  pointData->at(i));\n}\n\n/*! \\internal\n  \n  called by QCPCurve::draw to generate a point vector (pixels) which represents the line of the\n  curve. Line segments that aren't visible in the current axis rect are handled in an optimized\n  way.\n*/\nvoid QCPCurve::getCurveData(QVector<QPointF> *lineData) const\n{\n  /* Extended sides of axis rect R divide space into 9 regions:\n     1__|_4_|__7\n     2__|_R_|__8\n     3  | 6 |  9\n     General idea: If the two points of a line segment are in the same region (that is not R), the line segment corner is removed.\n     Curves outside R become straight lines closely outside of R which greatly reduces drawing time, yet keeps the look of lines and\n     fills inside R consistent.\n     The region R has index 5.\n  */\n  QCPAxis *keyAxis = mKeyAxis.data();\n  QCPAxis *valueAxis = mValueAxis.data();\n  if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << \"invalid key or value axis\"; return; }\n  \n  QRect axisRect = mKeyAxis.data()->axisRect()->rect() & mValueAxis.data()->axisRect()->rect();\n  lineData->reserve(mData->size());\n  QCPCurveDataMap::const_iterator it;\n  int lastRegion = 5;\n  int currentRegion = 5;\n  double RLeft = keyAxis->range().lower;\n  double RRight = keyAxis->range().upper;\n  double RBottom = valueAxis->range().lower;\n  double RTop = valueAxis->range().upper;\n  double x, y; // current key/value\n  bool addedLastAlready = true;\n  bool firstPoint = true; // first point must always be drawn, to make sure fill works correctly\n  for (it = mData->constBegin(); it != mData->constEnd(); ++it)\n  {\n    x = it.value().key;\n    y = it.value().value;\n    // determine current region:\n    if (x < RLeft) // region 123\n    {\n      if (y > RTop)\n        currentRegion = 1;\n      else if (y < RBottom)\n        currentRegion = 3;\n      else\n        currentRegion = 2;\n    } else if (x > RRight) // region 789\n    {\n      if (y > RTop)\n        currentRegion = 7;\n      else if (y < RBottom)\n        currentRegion = 9;\n      else\n        currentRegion = 8;\n    } else // region 456\n    {\n      if (y > RTop)\n        currentRegion = 4;\n      else if (y < RBottom)\n        currentRegion = 6;\n      else\n        currentRegion = 5;\n    }\n    \n    /*\n      Watch out, the next part is very tricky. It modifies the curve such that it seems like the\n      whole thing is still drawn, but actually the points outside the axisRect are simplified\n      (\"optimized\") greatly. There are some subtle special cases when line segments are large and\n      thereby each subsequent point may be in a different region or even skip some.\n    */\n    // determine whether to keep current point:\n    if (currentRegion == 5 || (firstPoint && mBrush.style() != Qt::NoBrush)) // current is in R, add current and last if it wasn't added already\n    {\n      if (!addedLastAlready) // in case curve just entered R, make sure the last point outside R is also drawn correctly\n        lineData->append(coordsToPixels((it-1).value().key, (it-1).value().value)); // add last point to vector\n      else if (lastRegion != 5) // added last already. If that's the case, we probably added it at optimized position. So go back and make sure it's at original position (else the angle changes under which this segment enters R)\n      {\n        if (!firstPoint) // because on firstPoint, currentRegion is 5 and addedLastAlready is true, although there is no last point\n          lineData->replace(lineData->size()-1, coordsToPixels((it-1).value().key, (it-1).value().value));\n      }\n      lineData->append(coordsToPixels(it.value().key, it.value().value)); // add current point to vector\n      addedLastAlready = true; // so in next iteration, we don't add this point twice\n    } else if (currentRegion != lastRegion) // changed region, add current and last if not added already\n    {\n      // using outsideCoordsToPixels instead of coorsToPixels for optimized point placement (places points just outside axisRect instead of potentially far away)\n      \n      // if we're coming from R or we skip diagonally over the corner regions (so line might still be visible in R), we can't place points optimized\n      if (lastRegion == 5 || // coming from R\n          ((lastRegion==2 && currentRegion==4) || (lastRegion==4 && currentRegion==2)) || // skip top left diagonal\n          ((lastRegion==4 && currentRegion==8) || (lastRegion==8 && currentRegion==4)) || // skip top right diagonal\n          ((lastRegion==8 && currentRegion==6) || (lastRegion==6 && currentRegion==8)) || // skip bottom right diagonal\n          ((lastRegion==6 && currentRegion==2) || (lastRegion==2 && currentRegion==6))    // skip bottom left diagonal\n          )\n      {\n        // always add last point if not added already, original:\n        if (!addedLastAlready)\n          lineData->append(coordsToPixels((it-1).value().key, (it-1).value().value));\n        // add current point, original:\n        lineData->append(coordsToPixels(it.value().key, it.value().value));\n      } else // no special case that forbids optimized point placement, so do it:\n      {\n        // always add last point if not added already, optimized:\n        if (!addedLastAlready)\n          lineData->append(outsideCoordsToPixels((it-1).value().key, (it-1).value().value, currentRegion, axisRect));\n        // add current point, optimized:\n        lineData->append(outsideCoordsToPixels(it.value().key, it.value().value, currentRegion, axisRect));\n      }\n      addedLastAlready = true; // so that if next point enters 5, or crosses another region boundary, we don't add this point twice\n    } else // neither in R, nor crossed a region boundary, skip current point\n    {\n      addedLastAlready = false;\n    }\n    lastRegion = currentRegion;\n    firstPoint = false;\n  }\n  // If curve ends outside R, we want to add very last point so the fill looks like it should when the curve started inside R:\n  if (lastRegion != 5 && mBrush.style() != Qt::NoBrush && !mData->isEmpty())\n    lineData->append(coordsToPixels((mData->constEnd()-1).value().key, (mData->constEnd()-1).value().value));\n}\n\n/*! \\internal\n  \n  Calculates the (minimum) distance (in pixels) the curve's representation has from the given \\a\n  pixelPoint in pixels. This is used to determine whether the curve was clicked or not, e.g. in\n  \\ref selectTest.\n*/\ndouble QCPCurve::pointDistance(const QPointF &pixelPoint) const\n{\n  if (mData->isEmpty())\n  {\n    qDebug() << Q_FUNC_INFO << \"requested point distance on curve\" << mName << \"without data\";\n    return 500;\n  }\n  if (mData->size() == 1)\n  {\n    QPointF dataPoint = coordsToPixels(mData->constBegin().key(), mData->constBegin().value().value);\n    return QVector2D(dataPoint-pixelPoint).length();\n  }\n  \n  // calculate minimum distance to line segments:\n  QVector<QPointF> *lineData = new QVector<QPointF>;\n  getCurveData(lineData);\n  double minDistSqr = std::numeric_limits<double>::max();\n  for (int i=0; i<lineData->size()-1; ++i)\n  {\n    double currentDistSqr = distSqrToLine(lineData->at(i), lineData->at(i+1), pixelPoint);\n    if (currentDistSqr < minDistSqr)\n      minDistSqr = currentDistSqr;\n  }\n  delete lineData;\n  return sqrt(minDistSqr);\n}\n\n/*! \\internal\n  \n  This is a specialized \\ref coordsToPixels function for points that are outside the visible\n  axisRect and just crossing a boundary (since \\ref getCurveData reduces non-visible curve segments\n  to those line segments that cross region boundaries, see documentation there). It only uses the\n  coordinate parallel to the region boundary of the axisRect. The other coordinate is picked just\n  outside the axisRect (how far is determined by the scatter size and the line width). Together\n  with the optimization in \\ref getCurveData this improves performance for large curves (or zoomed\n  in ones) significantly while keeping the illusion the whole curve and its filling is still being\n  drawn for the viewer.\n*/\nQPointF QCPCurve::outsideCoordsToPixels(double key, double value, int region, QRect axisRect) const\n{\n  int margin = qCeil(qMax(mScatterStyle.size(), (double)mPen.widthF())) + 2;\n  QPointF result = coordsToPixels(key, value);\n  switch (region)\n  {\n    case 2: result.setX(axisRect.left()-margin); break; // left\n    case 8: result.setX(axisRect.right()+margin); break; // right\n    case 4: result.setY(axisRect.top()-margin); break; // top\n    case 6: result.setY(axisRect.bottom()+margin); break; // bottom\n    case 1: result.setX(axisRect.left()-margin);\n            result.setY(axisRect.top()-margin); break; // top left\n    case 7: result.setX(axisRect.right()+margin);\n            result.setY(axisRect.top()-margin); break; // top right\n    case 9: result.setX(axisRect.right()+margin);\n            result.setY(axisRect.bottom()+margin); break; // bottom right\n    case 3: result.setX(axisRect.left()-margin);\n            result.setY(axisRect.bottom()+margin); break; // bottom left\n  }\n  return result;\n}\n\n/* inherits documentation from base class */\nQCPRange QCPCurve::getKeyRange(bool &foundRange, SignDomain inSignDomain) const\n{\n  QCPRange range;\n  bool haveLower = false;\n  bool haveUpper = false;\n  \n  double current;\n  \n  QCPCurveDataMap::const_iterator it = mData->constBegin();\n  while (it != mData->constEnd())\n  {\n    current = it.value().key;\n    if (inSignDomain == sdBoth || (inSignDomain == sdNegative && current < 0) || (inSignDomain == sdPositive && current > 0))\n    {\n      if (current < range.lower || !haveLower)\n      {\n        range.lower = current;\n        haveLower = true;\n      }\n      if (current > range.upper || !haveUpper)\n      {\n        range.upper = current;\n        haveUpper = true;\n      }\n    }\n    ++it;\n  }\n  \n  foundRange = haveLower && haveUpper;\n  return range;\n}\n\n/* inherits documentation from base class */\nQCPRange QCPCurve::getValueRange(bool &foundRange, SignDomain inSignDomain) const\n{\n  QCPRange range;\n  bool haveLower = false;\n  bool haveUpper = false;\n  \n  double current;\n  \n  QCPCurveDataMap::const_iterator it = mData->constBegin();\n  while (it != mData->constEnd())\n  {\n    current = it.value().value;\n    if (inSignDomain == sdBoth || (inSignDomain == sdNegative && current < 0) || (inSignDomain == sdPositive && current > 0))\n    {\n      if (current < range.lower || !haveLower)\n      {\n        range.lower = current;\n        haveLower = true;\n      }\n      if (current > range.upper || !haveUpper)\n      {\n        range.upper = current;\n        haveUpper = true;\n      }\n    }\n    ++it;\n  }\n  \n  foundRange = haveLower && haveUpper;\n  return range;\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPBarData\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPBarData\n  \\brief Holds the data of one single data point (one bar) for QCPBars.\n  \n  The container for storing multiple data points is \\ref QCPBarDataMap.\n  \n  The stored data is:\n  \\li \\a key: coordinate on the key axis of this bar\n  \\li \\a value: height coordinate on the value axis of this bar\n  \n  \\see QCPBarDataaMap\n*/\n\n/*!\n  Constructs a bar data point with key and value set to zero.\n*/\nQCPBarData::QCPBarData() :\n  key(0),\n  value(0)\n{\n}\n\n/*!\n  Constructs a bar data point with the specified \\a key and \\a value.\n*/\nQCPBarData::QCPBarData(double key, double value) :\n  key(key),\n  value(value)\n{\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPBars\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPBars\n  \\brief A plottable representing a bar chart in a plot.\n\n  \\image html QCPBars.png\n  \n  To plot data, assign it with the \\ref setData or \\ref addData functions.\n  \n  \\section appearance Changing the appearance\n  \n  The appearance of the bars is determined by the pen and the brush (\\ref setPen, \\ref setBrush).\n  \n  Bar charts are stackable. This means, Two QCPBars plottables can be placed on top of each other\n  (see \\ref QCPBars::moveAbove). Then, when two bars are at the same key position, they will appear\n  stacked.\n  \n  \\section usage Usage\n  \n  Like all data representing objects in QCustomPlot, the QCPBars is a plottable\n  (QCPAbstractPlottable). So the plottable-interface of QCustomPlot applies\n  (QCustomPlot::plottable, QCustomPlot::addPlottable, QCustomPlot::removePlottable, etc.)\n  \n  Usually, you first create an instance:\n  \\code\n  QCPBars *newBars = new QCPBars(customPlot->xAxis, customPlot->yAxis);\\endcode\n  add it to the customPlot with QCustomPlot::addPlottable:\n  \\code\n  customPlot->addPlottable(newBars);\\endcode\n  and then modify the properties of the newly created plottable, e.g.:\n  \\code\n  newBars->setName(\"Country population\");\n  newBars->setData(xData, yData);\\endcode\n*/\n\n/*! \\fn QCPBars *QCPBars::barBelow() const\n  Returns the bars plottable that is directly below this bars plottable.\n  If there is no such plottable, returns 0.\n  \n  \\see barAbove, moveBelow, moveAbove\n*/\n\n/*! \\fn QCPBars *QCPBars::barAbove() const\n  Returns the bars plottable that is directly above this bars plottable.\n  If there is no such plottable, returns 0.\n  \n  \\see barBelow, moveBelow, moveAbove\n*/\n\n/*!\n  Constructs a bar chart which uses \\a keyAxis as its key axis (\"x\") and \\a valueAxis as its value\n  axis (\"y\"). \\a keyAxis and \\a valueAxis must reside in the same QCustomPlot instance and not have\n  the same orientation. If either of these restrictions is violated, a corresponding message is\n  printed to the debug output (qDebug), the construction is not aborted, though.\n  \n  The constructed QCPBars can be added to the plot with QCustomPlot::addPlottable, QCustomPlot\n  then takes ownership of the bar chart.\n*/\nQCPBars::QCPBars(QCPAxis *keyAxis, QCPAxis *valueAxis) :\n  QCPAbstractPlottable(keyAxis, valueAxis)\n{\n  mData = new QCPBarDataMap;\n  mPen.setColor(Qt::blue);\n  mPen.setStyle(Qt::SolidLine);\n  mBrush.setColor(QColor(40, 50, 255, 30));\n  mBrush.setStyle(Qt::SolidPattern);\n  mSelectedPen = mPen;\n  mSelectedPen.setWidthF(2.5);\n  mSelectedPen.setColor(QColor(80, 80, 255)); // lighter than Qt::blue of mPen\n  mSelectedBrush = mBrush;\n  \n  mWidth = 0.75;\n}\n\nQCPBars::~QCPBars()\n{\n  if (mBarBelow || mBarAbove)\n    connectBars(mBarBelow.data(), mBarAbove.data()); // take this bar out of any stacking\n  delete mData;\n}\n\n/*!\n  Sets the width of the bars in plot (key) coordinates.\n*/\nvoid QCPBars::setWidth(double width)\n{\n  mWidth = width;\n}\n\n/*!\n  Replaces the current data with the provided \\a data.\n  \n  If \\a copy is set to true, data points in \\a data will only be copied. if false, the plottable\n  takes ownership of the passed data and replaces the internal data pointer with it. This is\n  significantly faster than copying for large datasets.\n*/\nvoid QCPBars::setData(QCPBarDataMap *data, bool copy)\n{\n  if (copy)\n  {\n    *mData = *data;\n  } else\n  {\n    delete mData;\n    mData = data;\n  }\n}\n\n/*! \\overload\n  \n  Replaces the current data with the provided points in \\a key and \\a value tuples. The\n  provided vectors should have equal length. Else, the number of added points will be the size of\n  the smallest vector.\n*/\nvoid QCPBars::setData(const QVector<double> &key, const QVector<double> &value)\n{\n  mData->clear();\n  int n = key.size();\n  n = qMin(n, value.size());\n  QCPBarData newData;\n  for (int i=0; i<n; ++i)\n  {\n    newData.key = key[i];\n    newData.value = value[i];\n    mData->insertMulti(newData.key, newData);\n  }\n}\n\n/*!\n  Moves this bars plottable below \\a bars. In other words, the bars of this plottable will appear\n  below the bars of \\a bars. The move target \\a bars must use the same key and value axis as this\n  plottable.\n  \n  Inserting into and removing from existing bar stacking is handled gracefully. If \\a bars already\n  has a bars object below itself, this bars object is inserted between the two. If this bars object\n  is already between two other bars, the two other bars will be stacked on top of each other after\n  the operation.\n  \n  To remove this bars plottable from any stacking, set \\a bars to 0.\n  \n  \\see moveBelow, barAbove, barBelow\n*/\nvoid QCPBars::moveBelow(QCPBars *bars)\n{\n  if (bars == this) return;\n  if (bars && (bars->keyAxis() != mKeyAxis.data() || bars->valueAxis() != mValueAxis.data()))\n  {\n    qDebug() << Q_FUNC_INFO << \"passed QCPBars* doesn't have same key and value axis as this QCPBars\";\n    return;\n  }\n  // remove from stacking:\n  connectBars(mBarBelow.data(), mBarAbove.data()); // Note: also works if one (or both) of them is 0\n  // if new bar given, insert this bar below it:\n  if (bars)\n  {\n    if (bars->mBarBelow)\n      connectBars(bars->mBarBelow.data(), this);\n    connectBars(this, bars);\n  }\n}\n\n/*!\n  Moves this bars plottable above \\a bars. In other words, the bars of this plottable will appear\n  above the bars of \\a bars. The move target \\a bars must use the same key and value axis as this\n  plottable.\n  \n  Inserting into and removing from existing bar stacking is handled gracefully. If \\a bars already\n  has a bars object below itself, this bars object is inserted between the two. If this bars object\n  is already between two other bars, the two other bars will be stacked on top of each other after\n  the operation.\n  \n  To remove this bars plottable from any stacking, set \\a bars to 0.\n  \n  \\see moveBelow, barBelow, barAbove\n*/\nvoid QCPBars::moveAbove(QCPBars *bars)\n{\n  if (bars == this) return;\n  if (bars && (bars->keyAxis() != mKeyAxis.data() || bars->valueAxis() != mValueAxis.data()))\n  {\n    qDebug() << Q_FUNC_INFO << \"passed QCPBars* doesn't have same key and value axis as this QCPBars\";\n    return;\n  }\n  // remove from stacking:\n  connectBars(mBarBelow.data(), mBarAbove.data()); // Note: also works if one (or both) of them is 0\n  // if new bar given, insert this bar above it:\n  if (bars)\n  {\n    if (bars->mBarAbove)\n      connectBars(this, bars->mBarAbove.data());\n    connectBars(bars, this);\n  }\n}\n\n/*!\n  Adds the provided data points in \\a dataMap to the current data.\n  \\see removeData\n*/\nvoid QCPBars::addData(const QCPBarDataMap &dataMap)\n{\n  mData->unite(dataMap);\n}\n\n/*! \\overload\n  Adds the provided single data point in \\a data to the current data.\n  \\see removeData\n*/\nvoid QCPBars::addData(const QCPBarData &data)\n{\n  mData->insertMulti(data.key, data);\n}\n\n/*! \\overload\n  Adds the provided single data point as \\a key and \\a value tuple to the current data\n  \\see removeData\n*/\nvoid QCPBars::addData(double key, double value)\n{\n  QCPBarData newData;\n  newData.key = key;\n  newData.value = value;\n  mData->insertMulti(newData.key, newData);\n}\n\n/*! \\overload\n  Adds the provided data points as \\a key and \\a value tuples to the current data.\n  \\see removeData\n*/\nvoid QCPBars::addData(const QVector<double> &keys, const QVector<double> &values)\n{\n  int n = keys.size();\n  n = qMin(n, values.size());\n  QCPBarData newData;\n  for (int i=0; i<n; ++i)\n  {\n    newData.key = keys[i];\n    newData.value = values[i];\n    mData->insertMulti(newData.key, newData);\n  }\n}\n\n/*!\n  Removes all data points with key smaller than \\a key.\n  \\see addData, clearData\n*/\nvoid QCPBars::removeDataBefore(double key)\n{\n  QCPBarDataMap::iterator it = mData->begin();\n  while (it != mData->end() && it.key() < key)\n    it = mData->erase(it);\n}\n\n/*!\n  Removes all data points with key greater than \\a key.\n  \\see addData, clearData\n*/\nvoid QCPBars::removeDataAfter(double key)\n{\n  if (mData->isEmpty()) return;\n  QCPBarDataMap::iterator it = mData->upperBound(key);\n  while (it != mData->end())\n    it = mData->erase(it);\n}\n\n/*!\n  Removes all data points with key between \\a fromKey and \\a toKey. if \\a fromKey is\n  greater or equal to \\a toKey, the function does nothing. To remove a single data point with known\n  key, use \\ref removeData(double key).\n  \n  \\see addData, clearData\n*/\nvoid QCPBars::removeData(double fromKey, double toKey)\n{\n  if (fromKey >= toKey || mData->isEmpty()) return;\n  QCPBarDataMap::iterator it = mData->upperBound(fromKey);\n  QCPBarDataMap::iterator itEnd = mData->upperBound(toKey);\n  while (it != itEnd)\n    it = mData->erase(it);\n}\n\n/*! \\overload\n  \n  Removes a single data point at \\a key. If the position is not known with absolute precision,\n  consider using \\ref removeData(double fromKey, double toKey) with a small fuzziness interval\n  around the suspected position, depeding on the precision with which the key is known.\n  \n  \\see addData, clearData\n*/\nvoid QCPBars::removeData(double key)\n{\n  mData->remove(key);\n}\n\n/*!\n  Removes all data points.\n  \\see removeData, removeDataAfter, removeDataBefore\n*/\nvoid QCPBars::clearData()\n{\n  mData->clear();\n}\n\n/* inherits documentation from base class */\ndouble QCPBars::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const\n{\n  Q_UNUSED(details)\n  if (onlySelectable && !mSelectable)\n    return -1;\n  if (!mKeyAxis || !mValueAxis) { qDebug() << Q_FUNC_INFO << \"invalid key or value axis\"; return -1; }\n  \n  if (mKeyAxis.data()->axisRect()->rect().contains(pos.toPoint()))\n  {\n    QCPBarDataMap::ConstIterator it;\n    double posKey, posValue;\n    pixelsToCoords(pos, posKey, posValue);\n    for (it = mData->constBegin(); it != mData->constEnd(); ++it)\n    {\n      double baseValue = getBaseValue(it.key(), it.value().value >=0);\n      QCPRange keyRange(it.key()-mWidth*0.5, it.key()+mWidth*0.5);\n      QCPRange valueRange(baseValue, baseValue+it.value().value);\n      if (keyRange.contains(posKey) && valueRange.contains(posValue))\n        return mParentPlot->selectionTolerance()*0.99;\n    }\n  }\n  return -1;\n}\n\n/* inherits documentation from base class */\nvoid QCPBars::draw(QCPPainter *painter)\n{\n  if (!mKeyAxis || !mValueAxis) { qDebug() << Q_FUNC_INFO << \"invalid key or value axis\"; return; }\n  if (mData->isEmpty()) return;\n  \n  QCPBarDataMap::const_iterator it;\n  for (it = mData->constBegin(); it != mData->constEnd(); ++it)\n  {\n    // skip bar if not visible in key axis range:\n    if (it.key()+mWidth*0.5 < mKeyAxis.data()->range().lower || it.key()-mWidth*0.5 > mKeyAxis.data()->range().upper)\n      continue;\n    // check data validity if flag set:\n#ifdef QCUSTOMPLOT_CHECK_DATA\n    if (QCP::isInvalidData(it.value().key, it.value().value))\n      qDebug() << Q_FUNC_INFO << \"Data point at\" << it.key() << \"of drawn range invalid.\" << \"Plottable name:\" << name();\n#endif\n    QPolygonF barPolygon = getBarPolygon(it.key(), it.value().value);\n    // draw bar fill:\n    if (mainBrush().style() != Qt::NoBrush && mainBrush().color().alpha() != 0)\n    {\n      applyFillAntialiasingHint(painter);\n      painter->setPen(Qt::NoPen);\n      painter->setBrush(mainBrush());\n      painter->drawPolygon(barPolygon);\n    }\n    // draw bar line:\n    if (mainPen().style() != Qt::NoPen && mainPen().color().alpha() != 0)\n    {\n      applyDefaultAntialiasingHint(painter);\n      painter->setPen(mainPen());\n      painter->setBrush(Qt::NoBrush);\n      painter->drawPolyline(barPolygon);\n    }\n  }\n}\n\n/* inherits documentation from base class */\nvoid QCPBars::drawLegendIcon(QCPPainter *painter, const QRectF &rect) const\n{\n  // draw filled rect:\n  applyDefaultAntialiasingHint(painter);\n  painter->setBrush(mBrush);\n  painter->setPen(mPen);\n  QRectF r = QRectF(0, 0, rect.width()*0.67, rect.height()*0.67);\n  r.moveCenter(rect.center());\n  painter->drawRect(r);\n}\n\n/*! \\internal\n  \n  Returns the polygon of a single bar with \\a key and \\a value. The Polygon is open at the bottom\n  and shifted according to the bar stacking (see \\ref moveAbove).\n*/\nQPolygonF QCPBars::getBarPolygon(double key, double value) const\n{\n  QPolygonF result;\n  double baseValue = getBaseValue(key, value >= 0);\n  result << coordsToPixels(key-mWidth*0.5, baseValue);\n  result << coordsToPixels(key-mWidth*0.5, baseValue+value);\n  result << coordsToPixels(key+mWidth*0.5, baseValue+value);\n  result << coordsToPixels(key+mWidth*0.5, baseValue);\n  return result;\n}\n\n/*! \\internal\n  \n  This function is called to find at which value to start drawing the base of a bar at \\a key, when\n  it is stacked on top of another QCPBars (e.g. with \\ref moveAbove).\n  \n  positive and negative bars are separated per stack (positive are stacked above 0-value upwards,\n  negative are stacked below 0-value downwards). This can be indicated with \\a positive. So if the\n  bar for which we need the base value is negative, set \\a positive to false.\n*/\ndouble QCPBars::getBaseValue(double key, bool positive) const\n{\n  if (mBarBelow)\n  {\n    double max = 0;\n    // find bars of mBarBelow that are approximately at key and find largest one:\n    QCPBarDataMap::const_iterator it = mBarBelow.data()->mData->lowerBound(key-mWidth*0.1);\n    QCPBarDataMap::const_iterator itEnd = mBarBelow.data()->mData->upperBound(key+mWidth*0.1);\n    while (it != itEnd)\n    {\n      if ((positive && it.value().value > max) ||\n          (!positive && it.value().value < max))\n        max = it.value().value;\n      ++it;\n    }\n    // recurse down the bar-stack to find the total height:\n    return max + mBarBelow.data()->getBaseValue(key, positive);\n  } else\n    return 0;\n}\n\n/*! \\internal\n\n  Connects \\a below and \\a above to each other via their mBarAbove/mBarBelow properties.\n  The bar(s) currently below lower and upper will become disconnected to lower/upper.\n  \n  If lower is zero, upper will be disconnected at the bottom.\n  If upper is zero, lower will be disconnected at the top.\n*/\nvoid QCPBars::connectBars(QCPBars *lower, QCPBars *upper)\n{\n  if (!lower && !upper) return;\n  \n  if (!lower) // disconnect upper at bottom\n  {\n    // disconnect old bar below upper:\n    if (upper->mBarBelow && upper->mBarBelow.data()->mBarAbove.data() == upper)\n      upper->mBarBelow.data()->mBarAbove = 0;\n    upper->mBarBelow = 0;\n  } else if (!upper) // disconnect lower at top\n  {\n    // disconnect old bar above lower:\n    if (lower->mBarAbove && lower->mBarAbove.data()->mBarBelow.data() == lower)\n      lower->mBarAbove.data()->mBarBelow = 0;\n    lower->mBarAbove = 0;\n  } else // connect lower and upper\n  {\n    // disconnect old bar above lower:\n    if (lower->mBarAbove && lower->mBarAbove.data()->mBarBelow.data() == lower)\n      lower->mBarAbove.data()->mBarBelow = 0;\n    // disconnect old bar below upper:\n    if (upper->mBarBelow && upper->mBarBelow.data()->mBarAbove.data() == upper)\n      upper->mBarBelow.data()->mBarAbove = 0;\n    lower->mBarAbove = upper;\n    upper->mBarBelow = lower;\n  }\n}\n\n/* inherits documentation from base class */\nQCPRange QCPBars::getKeyRange(bool &foundRange, SignDomain inSignDomain) const\n{\n  QCPRange range;\n  bool haveLower = false;\n  bool haveUpper = false;\n  \n  double current;\n  double barWidthHalf = mWidth*0.5;\n  QCPBarDataMap::const_iterator it = mData->constBegin();\n  while (it != mData->constEnd())\n  {\n    current = it.value().key;\n    if (inSignDomain == sdBoth || (inSignDomain == sdNegative && current+barWidthHalf < 0) || (inSignDomain == sdPositive && current-barWidthHalf > 0))\n    {\n      if (current-barWidthHalf < range.lower || !haveLower)\n      {\n        range.lower = current-barWidthHalf;\n        haveLower = true;\n      }\n      if (current+barWidthHalf > range.upper || !haveUpper)\n      {\n        range.upper = current+barWidthHalf;\n        haveUpper = true;\n      }\n    }\n    ++it;\n  }\n  \n  foundRange = haveLower && haveUpper;\n  return range;\n}\n\n/* inherits documentation from base class */\nQCPRange QCPBars::getValueRange(bool &foundRange, SignDomain inSignDomain) const\n{\n  QCPRange range;\n  bool haveLower = true; // set to true, because 0 should always be visible in bar charts\n  bool haveUpper = true; // set to true, because 0 should always be visible in bar charts\n  \n  double current;\n  \n  QCPBarDataMap::const_iterator it = mData->constBegin();\n  while (it != mData->constEnd())\n  {\n    current = it.value().value + getBaseValue(it.value().key, it.value().value >= 0);\n    if (inSignDomain == sdBoth || (inSignDomain == sdNegative && current < 0) || (inSignDomain == sdPositive && current > 0))\n    {\n      if (current < range.lower || !haveLower)\n      {\n        range.lower = current;\n        haveLower = true;\n      }\n      if (current > range.upper || !haveUpper)\n      {\n        range.upper = current;\n        haveUpper = true;\n      }\n    }\n    ++it;\n  }\n  \n  foundRange = true; // return true because bar charts always have the 0-line visible\n  return range;\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPStatisticalBox\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPStatisticalBox\n  \\brief A plottable representing a single statistical box in a plot.\n\n  \\image html QCPStatisticalBox.png\n  \n  To plot data, assign it with the individual parameter functions or use \\ref setData to set all\n  parameters at once. The individual functions are:\n  \\li \\ref setMinimum\n  \\li \\ref setLowerQuartile\n  \\li \\ref setMedian\n  \\li \\ref setUpperQuartile\n  \\li \\ref setMaximum\n  \n  Additionally you can define a list of outliers, drawn as scatter datapoints:\n  \\li \\ref setOutliers\n  \n  \\section appearance Changing the appearance\n  \n  The appearance of the box itself is controlled via \\ref setPen and \\ref setBrush. You may change\n  the width of the box with \\ref setWidth in plot coordinates (not pixels).\n\n  Analog functions exist for the minimum/maximum-whiskers: \\ref setWhiskerPen, \\ref\n  setWhiskerBarPen, \\ref setWhiskerWidth. The whisker width is the width of the bar at the top\n  (maximum) and bottom (minimum).\n  \n  The median indicator line has its own pen, \\ref setMedianPen.\n  \n  If the whisker backbone pen is changed, make sure to set the capStyle to Qt::FlatCap. Else, the\n  backbone line might exceed the whisker bars by a few pixels due to the pen cap being not\n  perfectly flat.\n  \n  The Outlier data points are drawn as normal scatter points. Their look can be controlled with\n  \\ref setOutlierStyle\n  \n  \\section usage Usage\n  \n  Like all data representing objects in QCustomPlot, the QCPStatisticalBox is a plottable\n  (QCPAbstractPlottable). So the plottable-interface of QCustomPlot applies\n  (QCustomPlot::plottable, QCustomPlot::addPlottable, QCustomPlot::removePlottable, etc.)\n  \n  Usually, you first create an instance:\n  \\code\n  QCPStatisticalBox *newBox = new QCPStatisticalBox(customPlot->xAxis, customPlot->yAxis);\\endcode\n  add it to the customPlot with QCustomPlot::addPlottable:\n  \\code\n  customPlot->addPlottable(newBox);\\endcode\n  and then modify the properties of the newly created plottable, e.g.:\n  \\code\n  newBox->setName(\"Measurement Series 1\");\n  newBox->setData(1, 3, 4, 5, 7);\n  newBox->setOutliers(QVector<double>() << 0.5 << 0.64 << 7.2 << 7.42);\\endcode\n*/\n\n/*!\n  Constructs a statistical box which uses \\a keyAxis as its key axis (\"x\") and \\a valueAxis as its\n  value axis (\"y\"). \\a keyAxis and \\a valueAxis must reside in the same QCustomPlot instance and\n  not have the same orientation. If either of these restrictions is violated, a corresponding\n  message is printed to the debug output (qDebug), the construction is not aborted, though.\n  \n  The constructed statistical box can be added to the plot with QCustomPlot::addPlottable,\n  QCustomPlot then takes ownership of the statistical box.\n*/\nQCPStatisticalBox::QCPStatisticalBox(QCPAxis *keyAxis, QCPAxis *valueAxis) :\n  QCPAbstractPlottable(keyAxis, valueAxis),\n  mKey(0),\n  mMinimum(0),\n  mLowerQuartile(0),\n  mMedian(0),\n  mUpperQuartile(0),\n  mMaximum(0)\n{\n  setOutlierStyle(QCPScatterStyle(QCPScatterStyle::ssCircle, Qt::blue, 6));\n  setWhiskerWidth(0.2);\n  setWidth(0.5);\n  \n  setPen(QPen(Qt::black));\n  setSelectedPen(QPen(Qt::blue, 2.5));\n  setMedianPen(QPen(Qt::black, 3, Qt::SolidLine, Qt::FlatCap));\n  setWhiskerPen(QPen(Qt::black, 0, Qt::DashLine, Qt::FlatCap));\n  setWhiskerBarPen(QPen(Qt::black));\n  setBrush(Qt::NoBrush);\n  setSelectedBrush(Qt::NoBrush);\n}\n\n/*!\n  Sets the key coordinate of the statistical box.\n*/\nvoid QCPStatisticalBox::setKey(double key)\n{\n  mKey = key;\n}\n\n/*!\n  Sets the parameter \"minimum\" of the statistical box plot. This is the position of the lower\n  whisker, typically the minimum measurement of the sample that's not considered an outlier.\n  \n  \\see setMaximum, setWhiskerPen, setWhiskerBarPen, setWhiskerWidth\n*/\nvoid QCPStatisticalBox::setMinimum(double value)\n{\n  mMinimum = value;\n}\n\n/*!\n  Sets the parameter \"lower Quartile\" of the statistical box plot. This is the lower end of the\n  box. The lower and the upper quartiles are the two statistical quartiles around the median of the\n  sample, they contain 50% of the sample data.\n  \n  \\see setUpperQuartile, setPen, setBrush, setWidth\n*/\nvoid QCPStatisticalBox::setLowerQuartile(double value)\n{\n  mLowerQuartile = value;\n}\n\n/*!\n  Sets the parameter \"median\" of the statistical box plot. This is the value of the median mark\n  inside the quartile box. The median separates the sample data in half (50% of the sample data is\n  below/above the median).\n  \n  \\see setMedianPen\n*/\nvoid QCPStatisticalBox::setMedian(double value)\n{\n  mMedian = value;\n}\n\n/*!\n  Sets the parameter \"upper Quartile\" of the statistical box plot. This is the upper end of the\n  box. The lower and the upper quartiles are the two statistical quartiles around the median of the\n  sample, they contain 50% of the sample data.\n  \n  \\see setLowerQuartile, setPen, setBrush, setWidth\n*/\nvoid QCPStatisticalBox::setUpperQuartile(double value)\n{\n  mUpperQuartile = value;\n}\n\n/*!\n  Sets the parameter \"maximum\" of the statistical box plot. This is the position of the upper\n  whisker, typically the maximum measurement of the sample that's not considered an outlier.\n  \n  \\see setMinimum, setWhiskerPen, setWhiskerBarPen, setWhiskerWidth\n*/\nvoid QCPStatisticalBox::setMaximum(double value)\n{\n  mMaximum = value;\n}\n\n/*!\n  Sets a vector of outlier values that will be drawn as scatters. Any data points in the sample\n  that are not within the whiskers (\\ref setMinimum, \\ref setMaximum) should be considered outliers\n  and displayed as such.\n  \n  \\see setOutlierStyle\n*/\nvoid QCPStatisticalBox::setOutliers(const QVector<double> &values)\n{\n  mOutliers = values;\n}\n\n/*!\n  Sets all parameters of the statistical box plot at once.\n  \n  \\see setKey, setMinimum, setLowerQuartile, setMedian, setUpperQuartile, setMaximum\n*/\nvoid QCPStatisticalBox::setData(double key, double minimum, double lowerQuartile, double median, double upperQuartile, double maximum)\n{\n  setKey(key);\n  setMinimum(minimum);\n  setLowerQuartile(lowerQuartile);\n  setMedian(median);\n  setUpperQuartile(upperQuartile);\n  setMaximum(maximum);\n}\n\n/*!\n  Sets the width of the box in key coordinates.\n  \n  \\see setWhiskerWidth\n*/\nvoid QCPStatisticalBox::setWidth(double width)\n{\n  mWidth = width;\n}\n\n/*!\n  Sets the width of the whiskers (\\ref setMinimum, \\ref setMaximum) in key coordinates.\n  \n  \\see setWidth\n*/\nvoid QCPStatisticalBox::setWhiskerWidth(double width)\n{\n  mWhiskerWidth = width;\n}\n\n/*!\n  Sets the pen used for drawing the whisker backbone (That's the line parallel to the value axis).\n  \n  Make sure to set the \\a pen capStyle to Qt::FlatCap to prevent the whisker backbone from reaching\n  a few pixels past the whisker bars, when using a non-zero pen width.\n  \n  \\see setWhiskerBarPen\n*/\nvoid QCPStatisticalBox::setWhiskerPen(const QPen &pen)\n{\n  mWhiskerPen = pen;\n}\n\n/*!\n  Sets the pen used for drawing the whisker bars (Those are the lines parallel to the key axis at\n  each end of the whisker backbone).\n  \n  \\see setWhiskerPen\n*/\nvoid QCPStatisticalBox::setWhiskerBarPen(const QPen &pen)\n{\n  mWhiskerBarPen = pen;\n}\n\n/*!\n  Sets the pen used for drawing the median indicator line inside the statistical box.\n*/\nvoid QCPStatisticalBox::setMedianPen(const QPen &pen)\n{\n  mMedianPen = pen;\n}\n\n/*!\n  Sets the appearance of the outlier data points.\n  \n  \\see setOutliers\n*/\nvoid QCPStatisticalBox::setOutlierStyle(const QCPScatterStyle &style)\n{\n  mOutlierStyle = style;\n}\n\n/* inherits documentation from base class */\nvoid QCPStatisticalBox::clearData()\n{\n  setOutliers(QVector<double>());\n  setKey(0);\n  setMinimum(0);\n  setLowerQuartile(0);\n  setMedian(0);\n  setUpperQuartile(0);\n  setMaximum(0);\n}\n\n/* inherits documentation from base class */\ndouble QCPStatisticalBox::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const\n{\n  Q_UNUSED(details)\n  if (onlySelectable && !mSelectable)\n    return -1;\n  if (!mKeyAxis || !mValueAxis) { qDebug() << Q_FUNC_INFO << \"invalid key or value axis\"; return -1; }\n  \n  if (mKeyAxis.data()->axisRect()->rect().contains(pos.toPoint()))\n  {\n    double posKey, posValue;\n    pixelsToCoords(pos, posKey, posValue);\n    // quartile box:\n    QCPRange keyRange(mKey-mWidth*0.5, mKey+mWidth*0.5);\n    QCPRange valueRange(mLowerQuartile, mUpperQuartile);\n    if (keyRange.contains(posKey) && valueRange.contains(posValue))\n      return mParentPlot->selectionTolerance()*0.99;\n    \n    // min/max whiskers:\n    if (QCPRange(mMinimum, mMaximum).contains(posValue))\n      return qAbs(mKeyAxis.data()->coordToPixel(mKey)-mKeyAxis.data()->coordToPixel(posKey));\n  }\n  return -1;\n}\n\n/* inherits documentation from base class */\nvoid QCPStatisticalBox::draw(QCPPainter *painter)\n{\n  if (!mKeyAxis || !mValueAxis) { qDebug() << Q_FUNC_INFO << \"invalid key or value axis\"; return; }\n\n  // check data validity if flag set:\n#ifdef QCUSTOMPLOT_CHECK_DATA\n  if (QCP::isInvalidData(mKey, mMedian) ||\n      QCP::isInvalidData(mLowerQuartile, mUpperQuartile) ||\n      QCP::isInvalidData(mMinimum, mMaximum))\n    qDebug() << Q_FUNC_INFO << \"Data point at\" << mKey << \"of drawn range has invalid data.\" << \"Plottable name:\" << name();\n  for (int i=0; i<mOutliers.size(); ++i)\n    if (QCP::isInvalidData(mOutliers.at(i)))\n      qDebug() << Q_FUNC_INFO << \"Data point outlier at\" << mKey << \"of drawn range invalid.\" << \"Plottable name:\" << name();\n#endif\n  \n  QRectF quartileBox;\n  drawQuartileBox(painter, &quartileBox);\n  \n  painter->save();\n  painter->setClipRect(quartileBox, Qt::IntersectClip);\n  drawMedian(painter);\n  painter->restore();\n  \n  drawWhiskers(painter);\n  drawOutliers(painter);\n}\n\n/* inherits documentation from base class */\nvoid QCPStatisticalBox::drawLegendIcon(QCPPainter *painter, const QRectF &rect) const\n{\n  // draw filled rect:\n  applyDefaultAntialiasingHint(painter);\n  painter->setPen(mPen);\n  painter->setBrush(mBrush);\n  QRectF r = QRectF(0, 0, rect.width()*0.67, rect.height()*0.67);\n  r.moveCenter(rect.center());\n  painter->drawRect(r);\n}\n\n/*! \\internal\n  \n  Draws the quartile box. \\a box is an output parameter that returns the quartile box (in pixel\n  coordinates) which is used to set the clip rect of the painter before calling \\ref drawMedian (so\n  the median doesn't draw outside the quartile box).\n*/\nvoid QCPStatisticalBox::drawQuartileBox(QCPPainter *painter, QRectF *quartileBox) const\n{\n  QRectF box;\n  box.setTopLeft(coordsToPixels(mKey-mWidth*0.5, mUpperQuartile));\n  box.setBottomRight(coordsToPixels(mKey+mWidth*0.5, mLowerQuartile));\n  applyDefaultAntialiasingHint(painter);\n  painter->setPen(mainPen());\n  painter->setBrush(mainBrush());\n  painter->drawRect(box);\n  if (quartileBox)\n    *quartileBox = box;\n}\n\n/*! \\internal\n  \n  Draws the median line inside the quartile box.\n*/\nvoid QCPStatisticalBox::drawMedian(QCPPainter *painter) const\n{\n  QLineF medianLine;\n  medianLine.setP1(coordsToPixels(mKey-mWidth*0.5, mMedian));\n  medianLine.setP2(coordsToPixels(mKey+mWidth*0.5, mMedian));\n  applyDefaultAntialiasingHint(painter);\n  painter->setPen(mMedianPen);\n  painter->drawLine(medianLine);\n}\n\n/*! \\internal\n  \n  Draws both whisker backbones and bars.\n*/\nvoid QCPStatisticalBox::drawWhiskers(QCPPainter *painter) const\n{\n  QLineF backboneMin, backboneMax, barMin, barMax;\n  backboneMax.setPoints(coordsToPixels(mKey, mUpperQuartile), coordsToPixels(mKey, mMaximum));\n  backboneMin.setPoints(coordsToPixels(mKey, mLowerQuartile), coordsToPixels(mKey, mMinimum));\n  barMax.setPoints(coordsToPixels(mKey-mWhiskerWidth*0.5, mMaximum), coordsToPixels(mKey+mWhiskerWidth*0.5, mMaximum));\n  barMin.setPoints(coordsToPixels(mKey-mWhiskerWidth*0.5, mMinimum), coordsToPixels(mKey+mWhiskerWidth*0.5, mMinimum));\n  applyErrorBarsAntialiasingHint(painter);\n  painter->setPen(mWhiskerPen);\n  painter->drawLine(backboneMin);\n  painter->drawLine(backboneMax);\n  painter->setPen(mWhiskerBarPen);\n  painter->drawLine(barMin);\n  painter->drawLine(barMax);\n}\n\n/*! \\internal\n  \n  Draws the outlier scatter points.\n*/\nvoid QCPStatisticalBox::drawOutliers(QCPPainter *painter) const\n{\n  applyScattersAntialiasingHint(painter);\n  mOutlierStyle.applyTo(painter, mPen);\n  for (int i=0; i<mOutliers.size(); ++i)\n    mOutlierStyle.drawShape(painter, coordsToPixels(mKey, mOutliers.at(i)));\n}\n\n/* inherits documentation from base class */\nQCPRange QCPStatisticalBox::getKeyRange(bool &foundRange, SignDomain inSignDomain) const\n{\n  foundRange = true;\n  if (inSignDomain == sdBoth)\n  {\n    return QCPRange(mKey-mWidth*0.5, mKey+mWidth*0.5);\n  } else if (inSignDomain == sdNegative)\n  {\n    if (mKey+mWidth*0.5 < 0)\n      return QCPRange(mKey-mWidth*0.5, mKey+mWidth*0.5);\n    else if (mKey < 0)\n      return QCPRange(mKey-mWidth*0.5, mKey);\n    else\n    {\n      foundRange = false;\n      return QCPRange();\n    }\n  } else if (inSignDomain == sdPositive)\n  {\n    if (mKey-mWidth*0.5 > 0)\n      return QCPRange(mKey-mWidth*0.5, mKey+mWidth*0.5);\n    else if (mKey > 0)\n      return QCPRange(mKey, mKey+mWidth*0.5);\n    else\n    {\n      foundRange = false;\n      return QCPRange();\n    }\n  }\n  foundRange = false;\n  return QCPRange();\n}\n\n/* inherits documentation from base class */\nQCPRange QCPStatisticalBox::getValueRange(bool &foundRange, SignDomain inSignDomain) const\n{\n  QVector<double> values; // values that must be considered (i.e. all outliers and the five box-parameters)\n  values.reserve(mOutliers.size() + 5);\n  values << mMaximum << mUpperQuartile << mMedian << mLowerQuartile << mMinimum;\n  values << mOutliers;\n  // go through values and find the ones in legal range:\n  bool haveUpper = false;\n  bool haveLower = false;\n  double upper = 0;\n  double lower = 0;\n  for (int i=0; i<values.size(); ++i)\n  {\n    if ((inSignDomain == sdNegative && values.at(i) < 0) ||\n        (inSignDomain == sdPositive && values.at(i) > 0) ||\n        (inSignDomain == sdBoth))\n    {\n      if (values.at(i) > upper || !haveUpper)\n      {\n        upper = values.at(i);\n        haveUpper = true;\n      }\n      if (values.at(i) < lower || !haveLower)\n      {\n        lower = values.at(i);\n        haveLower = true;\n      }\n    }\n  }\n  // return the bounds if we found some sensible values:\n  if (haveLower && haveUpper)\n  {\n    foundRange = true;\n    return QCPRange(lower, upper);\n  } else // might happen if all values are in other sign domain\n  {\n    foundRange = false;\n    return QCPRange();\n  }\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPColorMapData\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPColorMapData\n  \\brief Holds the two-dimensional data of a QCPColorMap plottable.\n  \n  This class is a data storage for \\ref QCPColorMap. It holds a two-dimensional array, which \\ref\n  QCPColorMap then displays as a 2D image in the plot, where the array values are represented by a\n  color, depending on the value.\n  \n  The size of the array can be controlled via \\ref setSize (or \\ref setKeySize, \\ref setValueSize).\n  Which plot coordinates these cells correspond to can be configured with \\ref setRange (or \\ref\n  setKeyRange, \\ref setValueRange).\n  \n  The data cells can be accessed in two ways: They can be directly addressed by an integer index\n  with \\ref setCell. This is the fastest method. Alternatively, they can be addressed by their plot\n  coordinate with \\ref setData. plot coordinate to cell index transformations and vice versa are\n  provided by the functions \\ref coordToCell and \\ref cellToCoord.\n  \n  This class also buffers the minimum and maximum values that are in the data set, to provide\n  QCPColorMap::rescaleDataRange with the necessary information quickly. Setting a cell to a value\n  that is greater than the current maximum increases this maximum to the new value. However,\n  setting the cell that currently holds the maximum value to a smaller value doesn't decrease the\n  maximum again, because finding the true new maximum would require going through the entire data\n  array, which might be time consuming. The same holds for the data minimum. This functionality is\n  given by \\ref recalculateDataBounds, such that you can decide when it is sensible to find the\n  true current minimum and maximum. The method QCPColorMap::rescaleDataRange offers a convenience\n  parameter \\a recalculateDataBounds which may be set to true to automatically call \\ref\n  recalculateDataBounds internally.\n*/\n\n/* start of documentation of inline functions */\n\n/*! \\fn bool QCPColorMapData::isEmpty() const\n  \n  Returns whether this instance carries no data. This is equivalent to having a size where at least\n  one of the dimensions is 0 (see \\ref setSize).\n*/\n\n/* end of documentation of inline functions */\n\n/*!\n  Constructs a new QCPColorMapData instance. The instance has \\a keySize cells in the key direction\n  and \\a valueSize cells in the value direction. These cells will be displayed by the \\ref QCPColorMap\n  at the coordinates \\a keyRange and \\a valueRange.\n  \n  \\see setSize, setKeySize, setValueSize, setRange, setKeyRange, setValueRange\n*/\nQCPColorMapData::QCPColorMapData(int keySize, int valueSize, const QCPRange &keyRange, const QCPRange &valueRange) :\n  mKeySize(0),\n  mValueSize(0),\n  mKeyRange(keyRange),\n  mValueRange(valueRange),\n  mIsEmpty(true),\n  mData(0),\n  mDataModified(true)\n{\n  setSize(keySize, valueSize);\n  fill(0);\n}\n\nQCPColorMapData::~QCPColorMapData()\n{\n  if (mData)\n    delete[] mData;\n}\n\n/*!\n  Constructs a new QCPColorMapData instance copying the data and range of \\a other.\n*/\nQCPColorMapData::QCPColorMapData(const QCPColorMapData &other) :\n  mKeySize(0),\n  mValueSize(0),\n  mIsEmpty(true),\n  mData(0),\n  mDataModified(true)\n{\n  *this = other;\n}\n\n/*!\n  Overwrites this color map data instance with the data stored in \\a other.\n*/\nQCPColorMapData &QCPColorMapData::operator=(const QCPColorMapData &other)\n{\n  if (&other != this)\n  {\n    const int keySize = other.keySize();\n    const int valueSize = other.valueSize();\n    setSize(keySize, valueSize);\n    setRange(other.keyRange(), other.valueRange());\n    if (!mIsEmpty)\n      memcpy(mData, other.mData, sizeof(mData[0])*keySize*valueSize);\n    mDataBounds = other.mDataBounds;\n    mDataModified = true;\n  }\n  return *this;\n}\n\n/* undocumented getter */\ndouble QCPColorMapData::data(double key, double value)\n{\n  int keyCell = (key-mKeyRange.lower)/(mKeyRange.upper-mKeyRange.lower)*(mKeySize-1)+0.5;\n  int valueCell = (1.0-(value-mValueRange.lower)/(mValueRange.upper-mValueRange.lower))*(mValueSize-1)+0.5;\n  if (keyCell >= 0 && keyCell < mKeySize && valueCell >= 0 && valueCell < mValueSize)\n    return mData[valueCell*mKeySize + keyCell];\n  else\n    return 0;\n}\n\n/* undocumented getter */\ndouble QCPColorMapData::cell(int keyIndex, int valueIndex)\n{\n  if (keyIndex >= 0 && keyIndex < mKeySize && valueIndex >= 0 && valueIndex < mValueSize)\n    return mData[valueIndex*mKeySize + keyIndex];\n  else\n    return 0;\n}\n\n/*!\n  Resizes the data array to have \\a keySize cells in the key dimension and \\a valueSize cells in\n  the value dimension.\n\n  The current data is discarded and the map cells are set to 0, unless the map had already the\n  requested size.\n  \n  Setting at least one of \\a keySize or \\a valueSize to zero frees the internal data array and \\ref\n  isEmpty returns true.\n\n  \\see setRange, setKeySize, setValueSize\n*/\nvoid QCPColorMapData::setSize(int keySize, int valueSize)\n{\n  if (keySize != mKeySize || valueSize != mValueSize)\n  {\n    mKeySize = keySize;\n    mValueSize = valueSize;\n    if (mData)\n      delete[] mData;\n    mIsEmpty = mKeySize == 0 || mValueSize == 0;\n    if (!mIsEmpty)\n    {\n#ifdef __EXCEPTIONS\n      try { // 2D arrays get memory intensive fast. So if the allocation fails, at least output debug message\n#endif\n      mData = new double[mKeySize*mValueSize];\n#ifdef __EXCEPTIONS\n      } catch (...) { mData = 0; }\n#endif\n      if (mData)\n        fill(0);\n      else\n        qDebug() << Q_FUNC_INFO << \"out of memory for data dimensions \"<< mKeySize << \"*\" << mValueSize;\n    } else\n      mData = 0;\n    mDataModified = true;\n  }\n}\n\n/*!\n  Resizes the data array to have \\a keySize cells in the key dimension.\n\n  The current data is discarded and the map cells are set to 0, unless the map had already the\n  requested size.\n  \n  Setting \\a keySize to zero frees the internal data array and \\ref isEmpty returns true.\n\n  \\see setKeyRange, setSize, setValueSize\n*/\nvoid QCPColorMapData::setKeySize(int keySize)\n{\n  setSize(keySize, mValueSize);\n}\n\n/*!\n  Resizes the data array to have \\a valueSize cells in the value dimension.\n\n  The current data is discarded and the map cells are set to 0, unless the map had already the\n  requested size.\n  \n  Setting \\a valueSize to zero frees the internal data array and \\ref isEmpty returns true.\n\n  \\see setValueRange, setSize, setKeySize\n*/\nvoid QCPColorMapData::setValueSize(int valueSize)\n{\n  setSize(mKeySize, valueSize);\n}\n\n/*!\n  Sets the coordinate ranges the data shall be distributed over. This defines the rectangular area\n  covered by the color map in plot coordinates.\n  \n  The outer cells will be centered on the range boundaries given to this function. For example, if\n  the key size (\\ref setKeySize) is 3 and \\a keyRange is set to <tt>QCPRange(2, 3)</tt> there will\n  be cells centered on the key coordinates 2, 2.5 and 3.\n \n  \\see setSize\n*/\nvoid QCPColorMapData::setRange(const QCPRange &keyRange, const QCPRange &valueRange)\n{\n  setKeyRange(keyRange);\n  setValueRange(valueRange);\n}\n\n/*!\n  Sets the coordinate range the data shall be distributed over in the key dimension. Together with\n  the value range, This defines the rectangular area covered by the color map in plot coordinates.\n  \n  The outer cells will be centered on the range boundaries given to this function. For example, if\n  the key size (\\ref setKeySize) is 3 and \\a keyRange is set to <tt>QCPRange(2, 3)</tt> there will\n  be cells centered on the key coordinates 2, 2.5 and 3.\n \n  \\see setRange, setValueRange, setSize\n*/\nvoid QCPColorMapData::setKeyRange(const QCPRange &keyRange)\n{\n  mKeyRange = keyRange;\n}\n\n/*!\n  Sets the coordinate range the data shall be distributed over in the value dimension. Together with\n  the key range, This defines the rectangular area covered by the color map in plot coordinates.\n  \n  The outer cells will be centered on the range boundaries given to this function. For example, if\n  the value size (\\ref setValueSize) is 3 and \\a valueRange is set to <tt>QCPRange(2, 3)</tt> there\n  will be cells centered on the value coordinates 2, 2.5 and 3.\n \n  \\see setRange, setKeyRange, setSize\n*/\nvoid QCPColorMapData::setValueRange(const QCPRange &valueRange)\n{\n  mValueRange = valueRange;\n}\n\n/*!\n  Sets the data of the cell, which lies at the plot coordinates given by \\a key and \\a value, to \\a\n  z.\n \n  \\see setCell, setRange\n*/\nvoid QCPColorMapData::setData(double key, double value, double z)\n{\n  int keyCell = (key-mKeyRange.lower)/(mKeyRange.upper-mKeyRange.lower)*(mKeySize-1)+0.5;\n  int valueCell = (value-mValueRange.lower)/(mValueRange.upper-mValueRange.lower)*(mValueSize-1)+0.5;\n  if (keyCell >= 0 && keyCell < mKeySize && valueCell >= 0 && valueCell < mValueSize)\n  {\n    mData[valueCell*mKeySize + keyCell] = z;\n    if (z < mDataBounds.lower)\n      mDataBounds.lower = z;\n    if (z > mDataBounds.upper)\n      mDataBounds.upper = z;\n     mDataModified = true;\n  }\n}\n\n/*!\n  Sets the data of the cell with indices \\a keyIndex and \\a valueIndex to \\a z. The indices\n  enumerate the cells starting from zero, up to the map's size-1 in the respective dimension (see\n  \\ref setSize).\n  \n  In the standard plot configuration (horizontal key axis and vertical value axis, both not\n  range-reversed), the cell with indices (0, 0) is in the bottom left corner and the cell with\n  indices (keySize-1, valueSize-1) is in the top right corner of the color map.\n  \n  \\see setData, setSize\n*/\nvoid QCPColorMapData::setCell(int keyIndex, int valueIndex, double z)\n{\n  if (keyIndex >= 0 && keyIndex < mKeySize && valueIndex >= 0 && valueIndex < mValueSize)\n  {\n    mData[valueIndex*mKeySize + keyIndex] = z;\n    if (z < mDataBounds.lower)\n      mDataBounds.lower = z;\n    if (z > mDataBounds.upper)\n      mDataBounds.upper = z;\n     mDataModified = true;\n  }\n}\n\n/*!\n  Goes through the data and updates the buffered minimum and maximum data values.\n  \n  Calling this method is only advised if you are about to call \\ref QCPColorMap::rescaleDataRange\n  and can not guarantee that the cells holding the maximum or minimum data haven't been overwritten\n  with a smaller or larger value respectively, since the buffered maximum/minimum values have been\n  updated the last time. Why this is the case is explained in the class description (\\ref\n  QCPColorMapData).\n  \n  Note that the method \\ref QCPColorMap::rescaleDataRange provides a parameter \\a\n  recalculateDataBounds for convenience. Setting this to true will call this method for you, before\n  doing the rescale.\n*/\nvoid QCPColorMapData::recalculateDataBounds()\n{\n  if (mKeySize > 0 && mValueSize > 0)\n  {\n    double minHeight = mData[0];\n    double maxHeight = mData[0];\n    const int dataCount = mValueSize*mKeySize;\n    for (int i=0; i<dataCount; ++i)\n    {\n      if (mData[i] > maxHeight)\n        maxHeight = mData[i];\n      if (mData[i] < minHeight)\n        minHeight = mData[i];\n    }\n    mDataBounds.lower = minHeight;\n    mDataBounds.upper = maxHeight;\n  }\n}\n\n/*!\n  Frees the internal data memory.\n  \n  This is equivalent to calling \\ref setSize \"setSize(0, 0)\".\n*/\nvoid QCPColorMapData::clear()\n{\n  setSize(0, 0);\n}\n\n/*!\n  Sets all cells to the value \\a z.\n*/\nvoid QCPColorMapData::fill(double z)\n{\n  const int dataCount = mValueSize*mKeySize;\n  for (int i=0; i<dataCount; ++i)\n    mData[i] = z;\n  mDataBounds = QCPRange(z, z);\n}\n\n/*!\n  Transforms plot coordinates given by \\a key and \\a value to cell indices of this QCPColorMapData\n  instance. The resulting cell indices are returned via the output parameters \\a keyIndex and \\a\n  valueIndex.\n  \n  The retrieved key/value cell indices can then be used for example with \\ref setCell.\n  \n  If you are only interested in a key or value index, you may pass 0 as \\a valueIndex or \\a\n  keyIndex.\n  \n  \\see cellToCoord, QCPAxis::coordToPixel\n*/\nvoid QCPColorMapData::coordToCell(double key, double value, int *keyIndex, int *valueIndex) const\n{\n  if (keyIndex)\n    *keyIndex = (key-mKeyRange.lower)/(mKeyRange.upper-mKeyRange.lower)*(mKeySize-1)+0.5;\n  if (valueIndex)\n    *valueIndex = (value-mValueRange.lower)/(mValueRange.upper-mValueRange.lower)*(mValueSize-1)+0.5;\n}\n\n/*!\n  Transforms cell indices given by \\a keyIndex and \\a valueIndex to cell indices of this QCPColorMapData\n  instance. The resulting coordinates are returned via the output parameters \\a key and \\a\n  value.\n  \n  If you are only interested in a key or value coordinate, you may pass 0 as \\a key or \\a\n  value.\n  \n  \\see coordToCell, QCPAxis::pixelToCoord\n*/\nvoid QCPColorMapData::cellToCoord(int keyIndex, int valueIndex, double *key, double *value) const\n{\n  if (key)\n    *key = keyIndex/(double)(mKeySize-1)*(mKeyRange.upper-mKeyRange.lower)+mKeyRange.lower;\n  if (value)\n    *value = valueIndex/(double)(mValueSize-1)*(mValueRange.upper-mValueRange.lower)+mValueRange.lower;\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPColorMap\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPColorMap\n  \\brief A plottable representing a two-dimensional color map in a plot.\n\n  \\image html QCPColorMap.png\n  \n  The data is stored in the class \\ref QCPColorMapData, which can be accessed via the data()\n  method.\n  \n  A color map has three dimensions to represent a data point: The \\a key dimension, the \\a value\n  dimension and the \\a data dimension. As with other plottables such as graphs, \\a key and \\a value\n  correspond to two orthogonal axes on the QCustomPlot surface that you specify in the QColorMap\n  constructor. The \\a data dimension however is encoded as the color of the point at (\\a key, \\a\n  value).\n\n  Set the number of points (or \\a cells) in the key/value dimension via \\ref\n  QCPColorMapData::setSize. The plot coordinate range over which these points will be displayed is\n  specified via \\ref QCPColorMapData::setRange. The first cell will be centered on the lower range\n  boundary and the last cell will be centered on the upper range boundary. The data can be set by\n  either accessing the cells directly with QCPColorMapData::setCell or by addressing the cells via\n  their plot coordinates with \\ref QCPColorMapData::setData. If possible, you should prefer\n  setCell, since it doesn't need to do any coordinate transformation and thus performs a bit\n  better.\n  \n  The cell with index (0, 0) is at the bottom left, if the color map uses normal (i.e. not reversed)\n  key and value axes.\n  \n  To show the user which colors correspond to which \\a data values, a \\ref QCPColorScale is\n  typically placed to the right of the axis rect. See the documentation there for details on how to\n  add and use a color scale.\n  \n  \\section appearance Changing the appearance\n  \n  The central part of the appearance is the color gradient, which can be specified via \\ref\n  setGradient. See the documentation of \\ref QCPColorGradient for details on configuring a color\n  gradient.\n  \n  The \\a data range that is mapped to the colors of the gradient can be specified with \\ref\n  setDataRange. To make the data range encompass the whole data set minimum to maximum, call \\ref\n  rescaleDataRange.\n  \n  \\section usage Usage\n  \n  Like all data representing objects in QCustomPlot, the QCPColorMap is a plottable\n  (QCPAbstractPlottable). So the plottable-interface of QCustomPlot applies\n  (QCustomPlot::plottable, QCustomPlot::addPlottable, QCustomPlot::removePlottable, etc.)\n  \n  Usually, you first create an instance:\n  \\code\n  QCPColorMap *colorMap = new QCPColorMap(customPlot->xAxis, customPlot->yAxis);\\endcode\n  add it to the customPlot with QCustomPlot::addPlottable:\n  \\code\n  customPlot->addPlottable(colorMap);\\endcode\n  and then modify the properties of the newly created color map, e.g.:\n  \\code\n  colorMap->data()->setSize(50, 50);\n  colorMap->data()->setRange(QCPRange(0, 2), QCPRange(0, 2));\n  for (int x=0; x<50; ++x)\n    for (int y=0; y<50; ++y)\n      colorMap->data()->setCell(x, y, qCos(x/10.0)+qSin(y/10.0));\n  colorMap->setGradient(QCPColorGradient::gpPolar);\n  colorMap->rescaleDataRange(true);\n  customPlot->rescaleAxes();\n  customPlot->replot();\n  \\endcode\n  \n  \\note The QCPColorMap always displays the data at equal key/value intervals, even if the key or\n  value axis is set to a logarithmic scaling. If you want to use QCPColorMap with logarithmic axes,\n  you shouldn't use the \\ref QCPColorMapData::setData method as it uses a linear transformation to\n  determine the cell index. Rather directly access the cell index with \\ref\n  QCPColorMapData::setCell.\n*/\n\n/* start documentation of inline functions */\n\n/*! \\fn QCPColorMapData *QCPColorMap::data() const\n  \n  Returns a pointer to the internal data storage of type \\ref QCPColorMapData. Access this to\n  modify data points (cells) and the color map key/value range.\n  \n  \\see setData\n*/\n\n/* end documentation of inline functions */\n\n/* start documentation of signals */\n\n/*! \\fn void QCPColorMap::dataRangeChanged(QCPRange newRange);\n  \n  This signal is emitted when the data range changes.\n  \n  \\see setDataRange\n*/\n\n/*! \\fn void QCPColorMap::dataScaleTypeChanged(QCPAxis::ScaleType scaleType);\n  \n  This signal is emitted when the data scale type changes.\n  \n  \\see setDataScaleType\n*/\n\n/*! \\fn void QCPColorMap::gradientChanged(QCPColorGradient newGradient);\n  \n  This signal is emitted when the gradient changes.\n  \n  \\see setGradient\n*/\n\n/* end documentation of signals */\n\n/*!\n  Constructs a color map with the specified \\a keyAxis and \\a valueAxis.\n  \n  The constructed QCPColorMap can be added to the plot with QCustomPlot::addPlottable, QCustomPlot\n  then takes ownership of the color map.\n*/\nQCPColorMap::QCPColorMap(QCPAxis *keyAxis, QCPAxis *valueAxis) :\n  QCPAbstractPlottable(keyAxis, valueAxis),\n  mDataScaleType(QCPAxis::stLinear),\n  mMapData(new QCPColorMapData(10, 10, QCPRange(0, 5), QCPRange(0, 5))),\n  mInterpolate(true),\n  mTightBoundary(false),\n  mMapImageInvalidated(true)\n{\n}\n\nQCPColorMap::~QCPColorMap()\n{\n  delete mMapData;\n}\n\n/*!\n  Replaces the current \\ref data with the provided \\a data.\n  \n  If \\a copy is set to true, the \\a data object will only be copied. if false, the color map\n  takes ownership of the passed data and replaces the internal data pointer with it. This is\n  significantly faster than copying for large datasets.\n*/\nvoid QCPColorMap::setData(QCPColorMapData *data, bool copy)\n{\n  if (copy)\n  {\n    *mMapData = *data;\n  } else\n  {\n    delete mMapData;\n    mMapData = data;\n  }\n  mMapImageInvalidated = true;\n}\n\n/*!\n  Sets the data range of this color map to \\a dataRange. The data range defines which data values\n  are mapped to the color gradient.\n  \n  To make the data range span the full range of the data set, use \\ref rescaleDataRange.\n  \n  \\see QCPColorScale::setDataRange\n*/\nvoid QCPColorMap::setDataRange(const QCPRange &dataRange)\n{\n  if (!QCPRange::validRange(dataRange)) return;\n  if (mDataRange.lower != dataRange.lower || mDataRange.upper != dataRange.upper)\n  {\n    if (mDataScaleType == QCPAxis::stLogarithmic)\n      mDataRange = dataRange.sanitizedForLogScale();\n    else\n      mDataRange = dataRange.sanitizedForLinScale();\n    mMapImageInvalidated = true;\n    emit dataRangeChanged(mDataRange);\n  }\n}\n\n/*!\n  Sets whether the data is correlated with the color gradient linearly or logarithmically.\n  \n  \\see QCPColorScale::setDataScaleType\n*/\nvoid QCPColorMap::setDataScaleType(QCPAxis::ScaleType scaleType)\n{\n  if (mDataScaleType != scaleType)\n  {\n    mDataScaleType = scaleType;\n    mMapImageInvalidated = true;\n    emit dataScaleTypeChanged(mDataScaleType);\n    if (mDataScaleType == QCPAxis::stLogarithmic)\n      setDataRange(mDataRange.sanitizedForLogScale());\n  }\n}\n\n/*!\n  Sets the color gradient that is used to represent the data. For more details on how to create an\n  own gradient or use one of the preset gradients, see \\ref QCPColorGradient.\n  \n  The colors defined by the gradient will be used to represent data values in the currently set\n  data range, see \\ref setDataRange. Data points that are outside this data range will either be\n  colored uniformly with the respective gradient boundary color, or the gradient will repeat,\n  depending on \\ref QCPColorGradient::setPeriodic.\n  \n  \\see QCPColorScale::setGradient\n*/\nvoid QCPColorMap::setGradient(const QCPColorGradient &gradient)\n{\n  if (mGradient != gradient)\n  {\n    mGradient = gradient;\n    mMapImageInvalidated = true;\n    emit gradientChanged(mGradient);\n  }\n}\n\n/*!\n  Sets whether the color map image shall use bicubic interpolation when displaying the color map\n  shrinked or expanded, and not at a 1:1 pixel-to-data scale.\n  \n  \\image html QCPColorMap-interpolate.png \"A 10*10 color map, with interpolation and without interpolation enabled\"\n*/\nvoid QCPColorMap::setInterpolate(bool enabled)\n{\n  mInterpolate = enabled;\n}\n\n/*!\n  Sets whether the outer most data rows and columns are clipped to the specified key and value\n  range (see \\ref QCPColorMapData::setKeyRange, \\ref QCPColorMapData::setValueRange).\n  \n  if \\a enabled is set to false, the data points at the border of the color map are drawn with the\n  same width and height as all other data points. Since the data points are represented by\n  rectangles of one color centered on the data coordinate, this means that the shown color map\n  extends by half a data point over the specified key/value range in each direction.\n  \n  \\image html QCPColorMap-tightboundary.png \"A color map, with tight boundary enabled and disabled\"\n*/\nvoid QCPColorMap::setTightBoundary(bool enabled)\n{\n  mTightBoundary = enabled;\n}\n\n/*!\n  Associates the color scale \\a colorScale with this color map.\n  \n  This means that both the color scale and the color map synchronize their gradient, data range and\n  data scale type (\\ref setGradient, \\ref setDataRange, \\ref setDataScaleType). Multiple color maps\n  can be associated with one single color scale. This causes the color maps to also synchronize\n  those properties, via the mutual color scale.\n  \n  This function causes the color map to adopt the current color gradient, data range and data scale\n  type of \\a colorScale. After this call, you may change these properties at either the color map\n  or the color scale, and the setting will be applied to both.\n  \n  Pass 0 as \\a colorScale to disconnect the color scale from this color map again.\n*/\nvoid QCPColorMap::setColorScale(QCPColorScale *colorScale)\n{\n  if (mColorScale) // unconnect signals from old color scale\n  {\n    disconnect(this, SIGNAL(dataRangeChanged(QCPRange)), mColorScale.data(), SLOT(setDataRange(QCPRange)));\n    disconnect(this, SIGNAL(dataScaleTypeChanged(QCPAxis::ScaleType)), mColorScale.data(), SLOT(setDataScaleType(QCPAxis::ScaleType)));\n    disconnect(this, SIGNAL(gradientChanged(QCPColorGradient)), mColorScale.data(), SLOT(setGradient(QCPColorGradient)));\n    disconnect(mColorScale.data(), SIGNAL(dataRangeChanged(QCPRange)), this, SLOT(setDataRange(QCPRange)));\n    disconnect(mColorScale.data(), SIGNAL(gradientChanged(QCPColorGradient)), this, SLOT(setGradient(QCPColorGradient)));\n    disconnect(mColorScale.data(), SIGNAL(dataScaleTypeChanged(QCPAxis::ScaleType)), this, SLOT(setDataScaleType(QCPAxis::ScaleType)));\n  }\n  mColorScale = colorScale;\n  if (mColorScale) // connect signals to new color scale\n  {\n    setGradient(mColorScale.data()->gradient());\n    setDataRange(mColorScale.data()->dataRange());\n    setDataScaleType(mColorScale.data()->dataScaleType());\n    connect(this, SIGNAL(dataRangeChanged(QCPRange)), mColorScale.data(), SLOT(setDataRange(QCPRange)));\n    connect(this, SIGNAL(dataScaleTypeChanged(QCPAxis::ScaleType)), mColorScale.data(), SLOT(setDataScaleType(QCPAxis::ScaleType)));\n    connect(this, SIGNAL(gradientChanged(QCPColorGradient)), mColorScale.data(), SLOT(setGradient(QCPColorGradient)));\n    connect(mColorScale.data(), SIGNAL(dataRangeChanged(QCPRange)), this, SLOT(setDataRange(QCPRange)));\n    connect(mColorScale.data(), SIGNAL(gradientChanged(QCPColorGradient)), this, SLOT(setGradient(QCPColorGradient)));\n    connect(mColorScale.data(), SIGNAL(dataScaleTypeChanged(QCPAxis::ScaleType)), this, SLOT(setDataScaleType(QCPAxis::ScaleType)));\n  }\n}\n\n/*!\n  Sets the data range (\\ref setDataRange) to span the minimum and maximum values that occur in the\n  current data set. This corresponds to the \\ref rescaleKeyAxis or \\ref rescaleValueAxis methods,\n  only for the third data dimension of the color map.\n  \n  The minimum and maximum values of the data set are buffered in the internal QCPColorMapData\n  instance (\\ref data). As data is updated via its \\ref QCPColorMapData::setCell or \\ref\n  QCPColorMapData::setData, the buffered minimum and maximum values are updated, too. For\n  performance reasons, however, they are only updated in an expanding fashion. So the buffered\n  maximum can only increase and the buffered minimum can only decrease. In consequence, changes to\n  the data that actually lower the maximum of the data set (by overwriting the cell holding the\n  current maximum with a smaller value), aren't recognized and the buffered maximum overestimates\n  the true maximum of the data set. The same happens for the buffered minimum. To recalculate the\n  true minimum and maximum by explicitly looking at each cell, the method\n  QCPColorMapData::recalculateDataBounds can be used. For convenience, setting the parameter \\a\n  recalculateDataBounds calls this method before setting the data range to the buffered minimum and\n  maximum.\n  \n  \\see setDataRange\n*/\nvoid QCPColorMap::rescaleDataRange(bool recalculateDataBounds)\n{\n  if (recalculateDataBounds)\n    mMapData->recalculateDataBounds();\n  setDataRange(mMapData->dataBounds());\n}\n\n/*!\n  Takes the current appearance of the color map and updates the legend icon, which is used to\n  represent this color map in the legend (see \\ref QCPLegend).\n  \n  The \\a transformMode specifies whether the rescaling is done by a faster, low quality image\n  scaling algorithm (Qt::FastTransformation) or by a slower, higher quality algorithm\n  (Qt::SmoothTransformation).\n  \n  The current color map appearance is scaled down to \\a thumbSize. Ideally, this should be equal to\n  the size of the legend icon (see \\ref QCPLegend::setIconSize). If it isn't exactly the configured\n  legend icon size, the thumb will be rescaled during drawing of the legend item.\n  \n  \\see setDataRange\n*/\nvoid QCPColorMap::updateLegendIcon(Qt::TransformationMode transformMode, const QSize &thumbSize)\n{\n  if (mMapImage.isNull() && !data()->isEmpty())\n    updateMapImage(); // try to update map image if it's null (happens if no draw has happened yet)\n  \n  if (!mMapImage.isNull()) // might still be null, e.g. if data is empty, so check here again\n  {\n    bool mirrorX = (keyAxis()->orientation() == Qt::Horizontal ? keyAxis() : valueAxis())->rangeReversed();\n    bool mirrorY = (valueAxis()->orientation() == Qt::Vertical ? valueAxis() : keyAxis())->rangeReversed();\n    mLegendIcon = QPixmap::fromImage(mMapImage.mirrored(mirrorX, mirrorY)).scaled(thumbSize, Qt::KeepAspectRatio, transformMode);\n  }\n}\n\n/*!\n  Clears the colormap data by calling \\ref QCPColorMapData::clear() on the internal data. This also\n  resizes the map to 0x0 cells.\n*/\nvoid QCPColorMap::clearData()\n{\n  mMapData->clear();\n}\n\n/* inherits documentation from base class */\ndouble QCPColorMap::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const\n{\n  Q_UNUSED(details)\n  if (onlySelectable && !mSelectable)\n    return -1;\n  if (!mKeyAxis || !mValueAxis) { qDebug() << Q_FUNC_INFO << \"invalid key or value axis\"; return -1; }\n  \n  if (mKeyAxis.data()->axisRect()->rect().contains(pos.toPoint()))\n  {\n    double posKey, posValue;\n    pixelsToCoords(pos, posKey, posValue);\n    if (mMapData->keyRange().contains(posKey) && mMapData->valueRange().contains(posValue))\n      return mParentPlot->selectionTolerance()*0.99;\n  }\n  return -1;\n}\n\n/*! \\internal\n  \n  Updates the internal map image buffer by going through the internal \\ref QCPColorMapData and\n  turning the data values into color pixels with \\ref QCPColorGradient::colorize.\n  \n  This method is called by \\ref QCPColorMap::draw if either the data has been modified or the map image\n  has been invalidated for a different reason (e.g. a change of the data range with \\ref\n  setDataRange).\n*/\nvoid QCPColorMap::updateMapImage()\n{\n  QCPAxis *keyAxis = mKeyAxis.data();\n  if (!keyAxis) return;\n  \n  // resize mMapImage to correct dimensions, according to key/value axes orientation:\n  if (keyAxis->orientation() == Qt::Horizontal && (mMapImage.size().width() != mMapData->keySize() || mMapImage.size().height() != mMapData->valueSize()))\n    mMapImage = QImage(QSize(mMapData->keySize(), mMapData->valueSize()), QImage::Format_RGB32);\n  else if (keyAxis->orientation() == Qt::Vertical && (mMapImage.size().width() != mMapData->valueSize() || mMapImage.size().height() != mMapData->keySize()))\n    mMapImage = QImage(QSize(mMapData->valueSize(), mMapData->keySize()), QImage::Format_RGB32);\n  \n  const int keySize = mMapData->keySize();\n  const int valueSize = mMapData->valueSize();\n  const double *rawData = mMapData->mData;\n  \n  if (keyAxis->orientation() == Qt::Horizontal)\n  {\n    const int lineCount = valueSize;\n    const int rowCount = keySize;\n    for (int line=0; line<lineCount; ++line)\n    {\n      QRgb* pixels = reinterpret_cast<QRgb*>(mMapImage.scanLine(lineCount-1-line)); // invert scanline index because QImage counts scanlines from top, but our vertical index counts from bottom (mathematical coordinate system)\n      mGradient.colorize(rawData+line*rowCount, mDataRange, pixels, rowCount, 1, mDataScaleType==QCPAxis::stLogarithmic);\n    }\n  } else // keyAxis->orientation() == Qt::Vertical\n  {\n    const int lineCount = keySize;\n    const int rowCount = valueSize;\n    for (int line=0; line<lineCount; ++line)\n    {\n      QRgb* pixels = reinterpret_cast<QRgb*>(mMapImage.scanLine(lineCount-1-line)); // invert scanline index because QImage counts scanlines from top, but our vertical index counts from bottom (mathematical coordinate system)\n      mGradient.colorize(rawData+line, mDataRange, pixels, rowCount, lineCount, mDataScaleType==QCPAxis::stLogarithmic);\n    }\n  }\n  \n  mMapData->mDataModified = false;\n  mMapImageInvalidated = false;\n}\n\n/* inherits documentation from base class */\nvoid QCPColorMap::draw(QCPPainter *painter)\n{\n  if (mMapData->isEmpty()) return;\n  if (!mKeyAxis || !mValueAxis) return;\n  applyDefaultAntialiasingHint(painter);\n  \n  if (mMapData->mDataModified || mMapImageInvalidated)\n    updateMapImage();\n  \n  double halfSampleKey = 0;\n  double halfSampleValue = 0;\n  if (mMapData->keySize() > 1)\n    halfSampleKey = 0.5*mMapData->keyRange().size()/(double)(mMapData->keySize()-1);\n  if (mMapData->valueSize() > 1)\n    halfSampleValue = 0.5*mMapData->valueRange().size()/(double)(mMapData->valueSize()-1);\n  QRectF imageRect(coordsToPixels(mMapData->keyRange().lower-halfSampleKey, mMapData->valueRange().lower-halfSampleValue),\n                   coordsToPixels(mMapData->keyRange().upper+halfSampleKey, mMapData->valueRange().upper+halfSampleValue));\n  imageRect = imageRect.normalized();\n  bool mirrorX = (keyAxis()->orientation() == Qt::Horizontal ? keyAxis() : valueAxis())->rangeReversed();\n  bool mirrorY = (valueAxis()->orientation() == Qt::Vertical ? valueAxis() : keyAxis())->rangeReversed();\n  bool smoothBackup = painter->renderHints().testFlag(QPainter::SmoothPixmapTransform);\n  painter->setRenderHint(QPainter::SmoothPixmapTransform, mInterpolate);\n  QRegion clipBackup;\n  if (mTightBoundary)\n  {\n    clipBackup = painter->clipRegion();\n    painter->setClipRect(QRectF(coordsToPixels(mMapData->keyRange().lower, mMapData->valueRange().lower),\n                                coordsToPixels(mMapData->keyRange().upper, mMapData->valueRange().upper)).normalized(), Qt::IntersectClip);\n  }\n  painter->drawImage(imageRect, mMapImage.mirrored(mirrorX, mirrorY));\n  if (mTightBoundary)\n    painter->setClipRegion(clipBackup);\n  painter->setRenderHint(QPainter::SmoothPixmapTransform, smoothBackup);\n}\n\n/* inherits documentation from base class */\nvoid QCPColorMap::drawLegendIcon(QCPPainter *painter, const QRectF &rect) const\n{\n  applyDefaultAntialiasingHint(painter);\n  // draw map thumbnail:\n  if (!mLegendIcon.isNull())\n  {\n    QPixmap scaledIcon = mLegendIcon.scaled(rect.size().toSize(), Qt::KeepAspectRatio, Qt::FastTransformation);\n    QRectF iconRect = QRectF(0, 0, scaledIcon.width(), scaledIcon.height());\n    iconRect.moveCenter(rect.center());\n    painter->drawPixmap(iconRect.topLeft(), scaledIcon);\n  }\n  /*\n  // draw frame:\n  painter->setBrush(Qt::NoBrush);\n  painter->setPen(Qt::black);\n  painter->drawRect(rect.adjusted(1, 1, 0, 0));\n  */\n}\n\n/* inherits documentation from base class */\nQCPRange QCPColorMap::getKeyRange(bool &foundRange, SignDomain inSignDomain) const\n{\n  foundRange = true;\n  QCPRange result = mMapData->keyRange();\n  result.normalize();\n  if (inSignDomain == QCPAbstractPlottable::sdPositive)\n  {\n    if (result.lower <= 0 && result.upper > 0)\n      result.lower = result.upper*1e-3;\n    else if (result.lower <= 0 && result.upper <= 0)\n      foundRange = false;\n  } else if (inSignDomain == QCPAbstractPlottable::sdNegative)\n  {\n    if (result.upper >= 0 && result.lower < 0)\n      result.upper = result.lower*1e-3;\n    else if (result.upper >= 0 && result.lower >= 0)\n      foundRange = false;\n  }\n  return result;\n}\n\n/* inherits documentation from base class */\nQCPRange QCPColorMap::getValueRange(bool &foundRange, SignDomain inSignDomain) const\n{\n  foundRange = true;\n  QCPRange result = mMapData->valueRange();\n  result.normalize();\n  if (inSignDomain == QCPAbstractPlottable::sdPositive)\n  {\n    if (result.lower <= 0 && result.upper > 0)\n      result.lower = result.upper*1e-3;\n    else if (result.lower <= 0 && result.upper <= 0)\n      foundRange = false;\n  } else if (inSignDomain == QCPAbstractPlottable::sdNegative)\n  {\n    if (result.upper >= 0 && result.lower < 0)\n      result.upper = result.lower*1e-3;\n    else if (result.upper >= 0 && result.lower >= 0)\n      foundRange = false;\n  }\n  return result;\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPItemStraightLine\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPItemStraightLine\n  \\brief A straight line that spans infinitely in both directions\n\n  \\image html QCPItemStraightLine.png \"Straight line example. Blue dotted circles are anchors, solid blue discs are positions.\"\n\n  It has two positions, \\a point1 and \\a point2, which define the straight line.\n*/\n\n/*!\n  Creates a straight line item and sets default values.\n  \n  The constructed item can be added to the plot with QCustomPlot::addItem.\n*/\nQCPItemStraightLine::QCPItemStraightLine(QCustomPlot *parentPlot) :\n  QCPAbstractItem(parentPlot),\n  point1(createPosition(\"point1\")),\n  point2(createPosition(\"point2\"))\n{\n  point1->setCoords(0, 0);\n  point2->setCoords(1, 1);\n  \n  setPen(QPen(Qt::black));\n  setSelectedPen(QPen(Qt::blue,2));\n}\n\nQCPItemStraightLine::~QCPItemStraightLine()\n{\n}\n\n/*!\n  Sets the pen that will be used to draw the line\n  \n  \\see setSelectedPen\n*/\nvoid QCPItemStraightLine::setPen(const QPen &pen)\n{\n  mPen = pen;\n}\n\n/*!\n  Sets the pen that will be used to draw the line when selected\n  \n  \\see setPen, setSelected\n*/\nvoid QCPItemStraightLine::setSelectedPen(const QPen &pen)\n{\n  mSelectedPen = pen;\n}\n\n/* inherits documentation from base class */\ndouble QCPItemStraightLine::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const\n{\n  Q_UNUSED(details)\n  if (onlySelectable && !mSelectable)\n    return -1;\n  \n  return distToStraightLine(QVector2D(point1->pixelPoint()), QVector2D(point2->pixelPoint()-point1->pixelPoint()), QVector2D(pos));\n}\n\n/* inherits documentation from base class */\nvoid QCPItemStraightLine::draw(QCPPainter *painter)\n{\n  QVector2D start(point1->pixelPoint());\n  QVector2D end(point2->pixelPoint());\n  // get visible segment of straight line inside clipRect:\n  double clipPad = mainPen().widthF();\n  QLineF line = getRectClippedStraightLine(start, end-start, clipRect().adjusted(-clipPad, -clipPad, clipPad, clipPad));\n  // paint visible segment, if existent:\n  if (!line.isNull())\n  {\n    painter->setPen(mainPen());\n    painter->drawLine(line);\n  }\n}\n\n/*! \\internal\n\n  finds the shortest distance of \\a point to the straight line defined by the base point \\a\n  base and the direction vector \\a vec.\n  \n  This is a helper function for \\ref selectTest.\n*/\ndouble QCPItemStraightLine::distToStraightLine(const QVector2D &base, const QVector2D &vec, const QVector2D &point) const\n{\n  return qAbs((base.y()-point.y())*vec.x()-(base.x()-point.x())*vec.y())/vec.length();\n}\n\n/*! \\internal\n\n  Returns the section of the straight line defined by \\a base and direction vector \\a\n  vec, that is visible in the specified \\a rect.\n  \n  This is a helper function for \\ref draw.\n*/\nQLineF QCPItemStraightLine::getRectClippedStraightLine(const QVector2D &base, const QVector2D &vec, const QRect &rect) const\n{\n  double bx, by;\n  double gamma;\n  QLineF result;\n  if (vec.x() == 0 && vec.y() == 0)\n    return result;\n  if (qFuzzyIsNull(vec.x())) // line is vertical\n  {\n    // check top of rect:\n    bx = rect.left();\n    by = rect.top();\n    gamma = base.x()-bx + (by-base.y())*vec.x()/vec.y();\n    if (gamma >= 0 && gamma <= rect.width())\n      result.setLine(bx+gamma, rect.top(), bx+gamma, rect.bottom()); // no need to check bottom because we know line is vertical\n  } else if (qFuzzyIsNull(vec.y())) // line is horizontal\n  {\n    // check left of rect:\n    bx = rect.left();\n    by = rect.top();\n    gamma = base.y()-by + (bx-base.x())*vec.y()/vec.x();\n    if (gamma >= 0 && gamma <= rect.height())\n      result.setLine(rect.left(), by+gamma, rect.right(), by+gamma); // no need to check right because we know line is horizontal\n  } else // line is skewed\n  {\n    QList<QVector2D> pointVectors;\n    // check top of rect:\n    bx = rect.left();\n    by = rect.top();\n    gamma = base.x()-bx + (by-base.y())*vec.x()/vec.y();\n    if (gamma >= 0 && gamma <= rect.width())\n      pointVectors.append(QVector2D(bx+gamma, by));\n    // check bottom of rect:\n    bx = rect.left();\n    by = rect.bottom();\n    gamma = base.x()-bx + (by-base.y())*vec.x()/vec.y();\n    if (gamma >= 0 && gamma <= rect.width())\n      pointVectors.append(QVector2D(bx+gamma, by));\n    // check left of rect:\n    bx = rect.left();\n    by = rect.top();\n    gamma = base.y()-by + (bx-base.x())*vec.y()/vec.x();\n    if (gamma >= 0 && gamma <= rect.height())\n      pointVectors.append(QVector2D(bx, by+gamma));\n    // check right of rect:\n    bx = rect.right();\n    by = rect.top();\n    gamma = base.y()-by + (bx-base.x())*vec.y()/vec.x();\n    if (gamma >= 0 && gamma <= rect.height())\n      pointVectors.append(QVector2D(bx, by+gamma));\n    \n    // evaluate points:\n    if (pointVectors.size() == 2)\n    {\n      result.setPoints(pointVectors.at(0).toPointF(), pointVectors.at(1).toPointF());\n    } else if (pointVectors.size() > 2)\n    {\n      // line probably goes through corner of rect, and we got two points there. single out the point pair with greatest distance:\n      double distSqrMax = 0;\n      QVector2D pv1, pv2;\n      for (int i=0; i<pointVectors.size()-1; ++i)\n      {\n        for (int k=i+1; k<pointVectors.size(); ++k)\n        {\n          double distSqr = (pointVectors.at(i)-pointVectors.at(k)).lengthSquared();\n          if (distSqr > distSqrMax)\n          {\n            pv1 = pointVectors.at(i);\n            pv2 = pointVectors.at(k);\n            distSqrMax = distSqr;\n          }\n        }\n      }\n      result.setPoints(pv1.toPointF(), pv2.toPointF());\n    }\n  }\n  return result;\n}\n\n/*! \\internal\n\n  Returns the pen that should be used for drawing lines. Returns mPen when the\n  item is not selected and mSelectedPen when it is.\n*/\nQPen QCPItemStraightLine::mainPen() const\n{\n  return mSelected ? mSelectedPen : mPen;\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPItemLine\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPItemLine\n  \\brief A line from one point to another\n\n  \\image html QCPItemLine.png \"Line example. Blue dotted circles are anchors, solid blue discs are positions.\"\n\n  It has two positions, \\a start and \\a end, which define the end points of the line.\n  \n  With \\ref setHead and \\ref setTail you may set different line ending styles, e.g. to create an arrow.\n*/\n\n/*!\n  Creates a line item and sets default values.\n  \n  The constructed item can be added to the plot with QCustomPlot::addItem.\n*/\nQCPItemLine::QCPItemLine(QCustomPlot *parentPlot) :\n  QCPAbstractItem(parentPlot),\n  start(createPosition(\"start\")),\n  end(createPosition(\"end\"))\n{\n  start->setCoords(0, 0);\n  end->setCoords(1, 1);\n  \n  setPen(QPen(Qt::black));\n  setSelectedPen(QPen(Qt::blue,2));\n}\n\nQCPItemLine::~QCPItemLine()\n{\n}\n\n/*!\n  Sets the pen that will be used to draw the line\n  \n  \\see setSelectedPen\n*/\nvoid QCPItemLine::setPen(const QPen &pen)\n{\n  mPen = pen;\n}\n\n/*!\n  Sets the pen that will be used to draw the line when selected\n  \n  \\see setPen, setSelected\n*/\nvoid QCPItemLine::setSelectedPen(const QPen &pen)\n{\n  mSelectedPen = pen;\n}\n\n/*!\n  Sets the line ending style of the head. The head corresponds to the \\a end position.\n  \n  Note that due to the overloaded QCPLineEnding constructor, you may directly specify\n  a QCPLineEnding::EndingStyle here, e.g. \\code setHead(QCPLineEnding::esSpikeArrow) \\endcode\n  \n  \\see setTail\n*/\nvoid QCPItemLine::setHead(const QCPLineEnding &head)\n{\n  mHead = head;\n}\n\n/*!\n  Sets the line ending style of the tail. The tail corresponds to the \\a start position.\n  \n  Note that due to the overloaded QCPLineEnding constructor, you may directly specify\n  a QCPLineEnding::EndingStyle here, e.g. \\code setTail(QCPLineEnding::esSpikeArrow) \\endcode\n  \n  \\see setHead\n*/\nvoid QCPItemLine::setTail(const QCPLineEnding &tail)\n{\n  mTail = tail;\n}\n\n/* inherits documentation from base class */\ndouble QCPItemLine::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const\n{\n  Q_UNUSED(details)\n  if (onlySelectable && !mSelectable)\n    return -1;\n  \n  return qSqrt(distSqrToLine(start->pixelPoint(), end->pixelPoint(), pos));\n}\n\n/* inherits documentation from base class */\nvoid QCPItemLine::draw(QCPPainter *painter)\n{\n  QVector2D startVec(start->pixelPoint());\n  QVector2D endVec(end->pixelPoint());\n  if (startVec.toPoint() == endVec.toPoint())\n    return;\n  // get visible segment of straight line inside clipRect:\n  double clipPad = qMax(mHead.boundingDistance(), mTail.boundingDistance());\n  clipPad = qMax(clipPad, (double)mainPen().widthF());\n  QLineF line = getRectClippedLine(startVec, endVec, clipRect().adjusted(-clipPad, -clipPad, clipPad, clipPad));\n  // paint visible segment, if existent:\n  if (!line.isNull())\n  {\n    painter->setPen(mainPen());\n    painter->drawLine(line);\n    painter->setBrush(Qt::SolidPattern);\n    if (mTail.style() != QCPLineEnding::esNone)\n      mTail.draw(painter, startVec, startVec-endVec);\n    if (mHead.style() != QCPLineEnding::esNone)\n      mHead.draw(painter, endVec, endVec-startVec);\n  }\n}\n\n/*! \\internal\n\n  Returns the section of the line defined by \\a start and \\a end, that is visible in the specified\n  \\a rect.\n  \n  This is a helper function for \\ref draw.\n*/\nQLineF QCPItemLine::getRectClippedLine(const QVector2D &start, const QVector2D &end, const QRect &rect) const\n{\n  bool containsStart = rect.contains(start.x(), start.y());\n  bool containsEnd = rect.contains(end.x(), end.y());\n  if (containsStart && containsEnd)\n    return QLineF(start.toPointF(), end.toPointF());\n  \n  QVector2D base = start;\n  QVector2D vec = end-start;\n  double bx, by;\n  double gamma, mu;\n  QLineF result;\n  QList<QVector2D> pointVectors;\n\n  if (!qFuzzyIsNull(vec.y())) // line is not horizontal\n  {\n    // check top of rect:\n    bx = rect.left();\n    by = rect.top();\n    mu = (by-base.y())/vec.y();\n    if (mu >= 0 && mu <= 1)\n    {\n      gamma = base.x()-bx + mu*vec.x();\n      if (gamma >= 0 && gamma <= rect.width())\n        pointVectors.append(QVector2D(bx+gamma, by));\n    }\n    // check bottom of rect:\n    bx = rect.left();\n    by = rect.bottom();\n    mu = (by-base.y())/vec.y();\n    if (mu >= 0 && mu <= 1)\n    {\n      gamma = base.x()-bx + mu*vec.x();\n      if (gamma >= 0 && gamma <= rect.width())\n        pointVectors.append(QVector2D(bx+gamma, by));\n    }\n  }\n  if (!qFuzzyIsNull(vec.x())) // line is not vertical\n  {\n    // check left of rect:\n    bx = rect.left();\n    by = rect.top();\n    mu = (bx-base.x())/vec.x();\n    if (mu >= 0 && mu <= 1)\n    {\n      gamma = base.y()-by + mu*vec.y();\n      if (gamma >= 0 && gamma <= rect.height())\n        pointVectors.append(QVector2D(bx, by+gamma));\n    }\n    // check right of rect:\n    bx = rect.right();\n    by = rect.top();\n    mu = (bx-base.x())/vec.x();\n    if (mu >= 0 && mu <= 1)\n    {\n      gamma = base.y()-by + mu*vec.y();\n      if (gamma >= 0 && gamma <= rect.height())\n        pointVectors.append(QVector2D(bx, by+gamma));\n    }\n  }\n  \n  if (containsStart)\n    pointVectors.append(start);\n  if (containsEnd)\n    pointVectors.append(end);\n  \n  // evaluate points:\n  if (pointVectors.size() == 2)\n  {\n    result.setPoints(pointVectors.at(0).toPointF(), pointVectors.at(1).toPointF());\n  } else if (pointVectors.size() > 2)\n  {\n    // line probably goes through corner of rect, and we got two points there. single out the point pair with greatest distance:\n    double distSqrMax = 0;\n    QVector2D pv1, pv2;\n    for (int i=0; i<pointVectors.size()-1; ++i)\n    {\n      for (int k=i+1; k<pointVectors.size(); ++k)\n      {\n        double distSqr = (pointVectors.at(i)-pointVectors.at(k)).lengthSquared();\n        if (distSqr > distSqrMax)\n        {\n          pv1 = pointVectors.at(i);\n          pv2 = pointVectors.at(k);\n          distSqrMax = distSqr;\n        }\n      }\n    }\n    result.setPoints(pv1.toPointF(), pv2.toPointF());\n  }\n  return result;\n}\n\n/*! \\internal\n\n  Returns the pen that should be used for drawing lines. Returns mPen when the\n  item is not selected and mSelectedPen when it is.\n*/\nQPen QCPItemLine::mainPen() const\n{\n  return mSelected ? mSelectedPen : mPen;\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPItemCurve\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPItemCurve\n  \\brief A curved line from one point to another\n\n  \\image html QCPItemCurve.png \"Curve example. Blue dotted circles are anchors, solid blue discs are positions.\"\n\n  It has four positions, \\a start and \\a end, which define the end points of the line, and two\n  control points which define the direction the line exits from the start and the direction from\n  which it approaches the end: \\a startDir and \\a endDir.\n  \n  With \\ref setHead and \\ref setTail you may set different line ending styles, e.g. to create an\n  arrow.\n  \n  Often it is desirable for the control points to stay at fixed relative positions to the start/end\n  point. This can be achieved by setting the parent anchor e.g. of \\a startDir simply to \\a start,\n  and then specify the desired pixel offset with QCPItemPosition::setCoords on \\a startDir.\n*/\n\n/*!\n  Creates a curve item and sets default values.\n  \n  The constructed item can be added to the plot with QCustomPlot::addItem.\n*/\nQCPItemCurve::QCPItemCurve(QCustomPlot *parentPlot) :\n  QCPAbstractItem(parentPlot),\n  start(createPosition(\"start\")),\n  startDir(createPosition(\"startDir\")),\n  endDir(createPosition(\"endDir\")),\n  end(createPosition(\"end\"))\n{\n  start->setCoords(0, 0);\n  startDir->setCoords(0.5, 0);\n  endDir->setCoords(0, 0.5);\n  end->setCoords(1, 1);\n  \n  setPen(QPen(Qt::black));\n  setSelectedPen(QPen(Qt::blue,2));\n}\n\nQCPItemCurve::~QCPItemCurve()\n{\n}\n\n/*!\n  Sets the pen that will be used to draw the line\n  \n  \\see setSelectedPen\n*/\nvoid QCPItemCurve::setPen(const QPen &pen)\n{\n  mPen = pen;\n}\n\n/*!\n  Sets the pen that will be used to draw the line when selected\n  \n  \\see setPen, setSelected\n*/\nvoid QCPItemCurve::setSelectedPen(const QPen &pen)\n{\n  mSelectedPen = pen;\n}\n\n/*!\n  Sets the line ending style of the head. The head corresponds to the \\a end position.\n  \n  Note that due to the overloaded QCPLineEnding constructor, you may directly specify\n  a QCPLineEnding::EndingStyle here, e.g. \\code setHead(QCPLineEnding::esSpikeArrow) \\endcode\n  \n  \\see setTail\n*/\nvoid QCPItemCurve::setHead(const QCPLineEnding &head)\n{\n  mHead = head;\n}\n\n/*!\n  Sets the line ending style of the tail. The tail corresponds to the \\a start position.\n  \n  Note that due to the overloaded QCPLineEnding constructor, you may directly specify\n  a QCPLineEnding::EndingStyle here, e.g. \\code setTail(QCPLineEnding::esSpikeArrow) \\endcode\n  \n  \\see setHead\n*/\nvoid QCPItemCurve::setTail(const QCPLineEnding &tail)\n{\n  mTail = tail;\n}\n\n/* inherits documentation from base class */\ndouble QCPItemCurve::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const\n{\n  Q_UNUSED(details)\n  if (onlySelectable && !mSelectable)\n    return -1;\n  \n  QPointF startVec(start->pixelPoint());\n  QPointF startDirVec(startDir->pixelPoint());\n  QPointF endDirVec(endDir->pixelPoint());\n  QPointF endVec(end->pixelPoint());\n\n  QPainterPath cubicPath(startVec);\n  cubicPath.cubicTo(startDirVec, endDirVec, endVec);\n  \n  QPolygonF polygon = cubicPath.toSubpathPolygons().first();\n  double minDistSqr = std::numeric_limits<double>::max();\n  for (int i=1; i<polygon.size(); ++i)\n  {\n    double distSqr = distSqrToLine(polygon.at(i-1), polygon.at(i), pos);\n    if (distSqr < minDistSqr)\n      minDistSqr = distSqr;\n  }\n  return qSqrt(minDistSqr);\n}\n\n/* inherits documentation from base class */\nvoid QCPItemCurve::draw(QCPPainter *painter)\n{\n  QPointF startVec(start->pixelPoint());\n  QPointF startDirVec(startDir->pixelPoint());\n  QPointF endDirVec(endDir->pixelPoint());\n  QPointF endVec(end->pixelPoint());\n  if (QVector2D(endVec-startVec).length() > 1e10f) // too large curves cause crash\n    return;\n\n  QPainterPath cubicPath(startVec);\n  cubicPath.cubicTo(startDirVec, endDirVec, endVec);\n\n  // paint visible segment, if existent:\n  QRect clip = clipRect().adjusted(-mainPen().widthF(), -mainPen().widthF(), mainPen().widthF(), mainPen().widthF());\n  QRect cubicRect = cubicPath.controlPointRect().toRect();\n  if (cubicRect.isEmpty()) // may happen when start and end exactly on same x or y position\n    cubicRect.adjust(0, 0, 1, 1);\n  if (clip.intersects(cubicRect))\n  {\n    painter->setPen(mainPen());\n    painter->drawPath(cubicPath);\n    painter->setBrush(Qt::SolidPattern);\n    if (mTail.style() != QCPLineEnding::esNone)\n      mTail.draw(painter, QVector2D(startVec), M_PI-cubicPath.angleAtPercent(0)/180.0*M_PI);\n    if (mHead.style() != QCPLineEnding::esNone)\n      mHead.draw(painter, QVector2D(endVec), -cubicPath.angleAtPercent(1)/180.0*M_PI);\n  }\n}\n\n/*! \\internal\n\n  Returns the pen that should be used for drawing lines. Returns mPen when the\n  item is not selected and mSelectedPen when it is.\n*/\nQPen QCPItemCurve::mainPen() const\n{\n  return mSelected ? mSelectedPen : mPen;\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPItemRect\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPItemRect\n  \\brief A rectangle\n\n  \\image html QCPItemRect.png \"Rectangle example. Blue dotted circles are anchors, solid blue discs are positions.\"\n\n  It has two positions, \\a topLeft and \\a bottomRight, which define the rectangle.\n*/\n\n/*!\n  Creates a rectangle item and sets default values.\n  \n  The constructed item can be added to the plot with QCustomPlot::addItem.\n*/\nQCPItemRect::QCPItemRect(QCustomPlot *parentPlot) :\n  QCPAbstractItem(parentPlot),\n  topLeft(createPosition(\"topLeft\")),\n  bottomRight(createPosition(\"bottomRight\")),\n  top(createAnchor(\"top\", aiTop)),\n  topRight(createAnchor(\"topRight\", aiTopRight)),\n  right(createAnchor(\"right\", aiRight)),\n  bottom(createAnchor(\"bottom\", aiBottom)),\n  bottomLeft(createAnchor(\"bottomLeft\", aiBottomLeft)),\n  left(createAnchor(\"left\", aiLeft))\n{\n  topLeft->setCoords(0, 1);\n  bottomRight->setCoords(1, 0);\n  \n  setPen(QPen(Qt::black));\n  setSelectedPen(QPen(Qt::blue,2));\n  setBrush(Qt::NoBrush);\n  setSelectedBrush(Qt::NoBrush);\n}\n\nQCPItemRect::~QCPItemRect()\n{\n}\n\n/*!\n  Sets the pen that will be used to draw the line of the rectangle\n  \n  \\see setSelectedPen, setBrush\n*/\nvoid QCPItemRect::setPen(const QPen &pen)\n{\n  mPen = pen;\n}\n\n/*!\n  Sets the pen that will be used to draw the line of the rectangle when selected\n  \n  \\see setPen, setSelected\n*/\nvoid QCPItemRect::setSelectedPen(const QPen &pen)\n{\n  mSelectedPen = pen;\n}\n\n/*!\n  Sets the brush that will be used to fill the rectangle. To disable filling, set \\a brush to\n  Qt::NoBrush.\n  \n  \\see setSelectedBrush, setPen\n*/\nvoid QCPItemRect::setBrush(const QBrush &brush)\n{\n  mBrush = brush;\n}\n\n/*!\n  Sets the brush that will be used to fill the rectangle when selected. To disable filling, set \\a\n  brush to Qt::NoBrush.\n  \n  \\see setBrush\n*/\nvoid QCPItemRect::setSelectedBrush(const QBrush &brush)\n{\n  mSelectedBrush = brush;\n}\n\n/* inherits documentation from base class */\ndouble QCPItemRect::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const\n{\n  Q_UNUSED(details)\n  if (onlySelectable && !mSelectable)\n    return -1;\n  \n  QRectF rect = QRectF(topLeft->pixelPoint(), bottomRight->pixelPoint()).normalized();\n  bool filledRect = mBrush.style() != Qt::NoBrush && mBrush.color().alpha() != 0;\n  return rectSelectTest(rect, pos, filledRect);\n}\n\n/* inherits documentation from base class */\nvoid QCPItemRect::draw(QCPPainter *painter)\n{\n  QPointF p1 = topLeft->pixelPoint();\n  QPointF p2 = bottomRight->pixelPoint();\n  if (p1.toPoint() == p2.toPoint())\n    return;\n  QRectF rect = QRectF(p1, p2).normalized();\n  double clipPad = mainPen().widthF();\n  QRectF boundingRect = rect.adjusted(-clipPad, -clipPad, clipPad, clipPad);\n  if (boundingRect.intersects(clipRect())) // only draw if bounding rect of rect item is visible in cliprect\n  {\n    painter->setPen(mainPen());\n    painter->setBrush(mainBrush());\n    painter->drawRect(rect);\n  }\n}\n\n/* inherits documentation from base class */\nQPointF QCPItemRect::anchorPixelPoint(int anchorId) const\n{\n  QRectF rect = QRectF(topLeft->pixelPoint(), bottomRight->pixelPoint());\n  switch (anchorId)\n  {\n    case aiTop:         return (rect.topLeft()+rect.topRight())*0.5;\n    case aiTopRight:    return rect.topRight();\n    case aiRight:       return (rect.topRight()+rect.bottomRight())*0.5;\n    case aiBottom:      return (rect.bottomLeft()+rect.bottomRight())*0.5;\n    case aiBottomLeft:  return rect.bottomLeft();\n    case aiLeft:        return (rect.topLeft()+rect.bottomLeft())*0.5;\n  }\n  \n  qDebug() << Q_FUNC_INFO << \"invalid anchorId\" << anchorId;\n  return QPointF();\n}\n\n/*! \\internal\n\n  Returns the pen that should be used for drawing lines. Returns mPen when the item is not selected\n  and mSelectedPen when it is.\n*/\nQPen QCPItemRect::mainPen() const\n{\n  return mSelected ? mSelectedPen : mPen;\n}\n\n/*! \\internal\n\n  Returns the brush that should be used for drawing fills of the item. Returns mBrush when the item\n  is not selected and mSelectedBrush when it is.\n*/\nQBrush QCPItemRect::mainBrush() const\n{\n  return mSelected ? mSelectedBrush : mBrush;\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPItemText\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPItemText\n  \\brief A text label\n\n  \\image html QCPItemText.png \"Text example. Blue dotted circles are anchors, solid blue discs are positions.\"\n\n  Its position is defined by the member \\a position and the setting of \\ref setPositionAlignment.\n  The latter controls which part of the text rect shall be aligned with \\a position.\n  \n  The text alignment itself (i.e. left, center, right) can be controlled with \\ref\n  setTextAlignment.\n  \n  The text may be rotated around the \\a position point with \\ref setRotation.\n*/\n\n/*!\n  Creates a text item and sets default values.\n  \n  The constructed item can be added to the plot with QCustomPlot::addItem.\n*/\nQCPItemText::QCPItemText(QCustomPlot *parentPlot) :\n  QCPAbstractItem(parentPlot),\n  position(createPosition(\"position\")),\n  topLeft(createAnchor(\"topLeft\", aiTopLeft)),\n  top(createAnchor(\"top\", aiTop)),\n  topRight(createAnchor(\"topRight\", aiTopRight)),\n  right(createAnchor(\"right\", aiRight)),\n  bottomRight(createAnchor(\"bottomRight\", aiBottomRight)),\n  bottom(createAnchor(\"bottom\", aiBottom)),\n  bottomLeft(createAnchor(\"bottomLeft\", aiBottomLeft)),\n  left(createAnchor(\"left\", aiLeft))\n{\n  position->setCoords(0, 0);\n  \n  setRotation(0);\n  setTextAlignment(Qt::AlignTop|Qt::AlignHCenter);\n  setPositionAlignment(Qt::AlignCenter);\n  setText(\"text\");\n  \n  setPen(Qt::NoPen);\n  setSelectedPen(Qt::NoPen);\n  setBrush(Qt::NoBrush);\n  setSelectedBrush(Qt::NoBrush);\n  setColor(Qt::black);\n  setSelectedColor(Qt::blue);\n}\n\nQCPItemText::~QCPItemText()\n{\n}\n\n/*!\n  Sets the color of the text.\n*/\nvoid QCPItemText::setColor(const QColor &color)\n{\n  mColor = color;\n}\n\n/*!\n  Sets the color of the text that will be used when the item is selected.\n*/\nvoid QCPItemText::setSelectedColor(const QColor &color)\n{\n  mSelectedColor = color;\n}\n\n/*!\n  Sets the pen that will be used do draw a rectangular border around the text. To disable the\n  border, set \\a pen to Qt::NoPen.\n  \n  \\see setSelectedPen, setBrush, setPadding\n*/\nvoid QCPItemText::setPen(const QPen &pen)\n{\n  mPen = pen;\n}\n\n/*!\n  Sets the pen that will be used do draw a rectangular border around the text, when the item is\n  selected. To disable the border, set \\a pen to Qt::NoPen.\n  \n  \\see setPen\n*/\nvoid QCPItemText::setSelectedPen(const QPen &pen)\n{\n  mSelectedPen = pen;\n}\n\n/*!\n  Sets the brush that will be used do fill the background of the text. To disable the\n  background, set \\a brush to Qt::NoBrush.\n  \n  \\see setSelectedBrush, setPen, setPadding\n*/\nvoid QCPItemText::setBrush(const QBrush &brush)\n{\n  mBrush = brush;\n}\n\n/*!\n  Sets the brush that will be used do fill the background of the text, when the item is selected. To disable the\n  background, set \\a brush to Qt::NoBrush.\n  \n  \\see setBrush\n*/\nvoid QCPItemText::setSelectedBrush(const QBrush &brush)\n{\n  mSelectedBrush = brush;\n}\n\n/*!\n  Sets the font of the text.\n  \n  \\see setSelectedFont, setColor\n*/\nvoid QCPItemText::setFont(const QFont &font)\n{\n  mFont = font;\n}\n\n/*!\n  Sets the font of the text that will be used when the item is selected.\n  \n  \\see setFont\n*/\nvoid QCPItemText::setSelectedFont(const QFont &font)\n{\n  mSelectedFont = font;\n}\n\n/*!\n  Sets the text that will be displayed. Multi-line texts are supported by inserting a line break\n  character, e.g. '\\n'.\n  \n  \\see setFont, setColor, setTextAlignment\n*/\nvoid QCPItemText::setText(const QString &text)\n{\n  mText = text;\n}\n\n/*!\n  Sets which point of the text rect shall be aligned with \\a position.\n  \n  Examples:\n  \\li If \\a alignment is <tt>Qt::AlignHCenter | Qt::AlignTop</tt>, the text will be positioned such\n  that the top of the text rect will be horizontally centered on \\a position.\n  \\li If \\a alignment is <tt>Qt::AlignLeft | Qt::AlignBottom</tt>, \\a position will indicate the\n  bottom left corner of the text rect.\n  \n  If you want to control the alignment of (multi-lined) text within the text rect, use \\ref\n  setTextAlignment.\n*/\nvoid QCPItemText::setPositionAlignment(Qt::Alignment alignment)\n{\n  mPositionAlignment = alignment;\n}\n\n/*!\n  Controls how (multi-lined) text is aligned inside the text rect (typically Qt::AlignLeft, Qt::AlignCenter or Qt::AlignRight).\n*/\nvoid QCPItemText::setTextAlignment(Qt::Alignment alignment)\n{\n  mTextAlignment = alignment;\n}\n\n/*!\n  Sets the angle in degrees by which the text (and the text rectangle, if visible) will be rotated\n  around \\a position.\n*/\nvoid QCPItemText::setRotation(double degrees)\n{\n  mRotation = degrees;\n}\n\n/*!\n  Sets the distance between the border of the text rectangle and the text. The appearance (and\n  visibility) of the text rectangle can be controlled with \\ref setPen and \\ref setBrush.\n*/\nvoid QCPItemText::setPadding(const QMargins &padding)\n{\n  mPadding = padding;\n}\n\n/* inherits documentation from base class */\ndouble QCPItemText::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const\n{\n  Q_UNUSED(details)\n  if (onlySelectable && !mSelectable)\n    return -1;\n  \n  // The rect may be rotated, so we transform the actual clicked pos to the rotated\n  // coordinate system, so we can use the normal rectSelectTest function for non-rotated rects:\n  QPointF positionPixels(position->pixelPoint());\n  QTransform inputTransform;\n  inputTransform.translate(positionPixels.x(), positionPixels.y());\n  inputTransform.rotate(-mRotation);\n  inputTransform.translate(-positionPixels.x(), -positionPixels.y());\n  QPointF rotatedPos = inputTransform.map(pos);\n  QFontMetrics fontMetrics(mFont);\n  QRect textRect = fontMetrics.boundingRect(0, 0, 0, 0, Qt::TextDontClip|mTextAlignment, mText);\n  QRect textBoxRect = textRect.adjusted(-mPadding.left(), -mPadding.top(), mPadding.right(), mPadding.bottom());\n  QPointF textPos = getTextDrawPoint(positionPixels, textBoxRect, mPositionAlignment);\n  textBoxRect.moveTopLeft(textPos.toPoint());\n\n  return rectSelectTest(textBoxRect, rotatedPos, true);\n}\n\n/* inherits documentation from base class */\nvoid QCPItemText::draw(QCPPainter *painter)\n{\n  QPointF pos(position->pixelPoint());\n  QTransform transform = painter->transform();\n  transform.translate(pos.x(), pos.y());\n  if (!qFuzzyIsNull(mRotation))\n    transform.rotate(mRotation);\n  painter->setFont(mainFont());\n  QRect textRect = painter->fontMetrics().boundingRect(0, 0, 0, 0, Qt::TextDontClip|mTextAlignment, mText);\n  QRect textBoxRect = textRect.adjusted(-mPadding.left(), -mPadding.top(), mPadding.right(), mPadding.bottom());\n  QPointF textPos = getTextDrawPoint(QPointF(0, 0), textBoxRect, mPositionAlignment); // 0, 0 because the transform does the translation\n  textRect.moveTopLeft(textPos.toPoint()+QPoint(mPadding.left(), mPadding.top()));\n  textBoxRect.moveTopLeft(textPos.toPoint());\n  double clipPad = mainPen().widthF();\n  QRect boundingRect = textBoxRect.adjusted(-clipPad, -clipPad, clipPad, clipPad);\n  if (transform.mapRect(boundingRect).intersects(painter->transform().mapRect(clipRect())))\n  {\n    painter->setTransform(transform);\n    if ((mainBrush().style() != Qt::NoBrush && mainBrush().color().alpha() != 0) ||\n        (mainPen().style() != Qt::NoPen && mainPen().color().alpha() != 0))\n    {\n      painter->setPen(mainPen());\n      painter->setBrush(mainBrush());\n      painter->drawRect(textBoxRect);\n    }\n    painter->setBrush(Qt::NoBrush);\n    painter->setPen(QPen(mainColor()));\n    painter->drawText(textRect, Qt::TextDontClip|mTextAlignment, mText);\n  }\n}\n\n/* inherits documentation from base class */\nQPointF QCPItemText::anchorPixelPoint(int anchorId) const\n{\n  // get actual rect points (pretty much copied from draw function):\n  QPointF pos(position->pixelPoint());\n  QTransform transform;\n  transform.translate(pos.x(), pos.y());\n  if (!qFuzzyIsNull(mRotation))\n    transform.rotate(mRotation);\n  QFontMetrics fontMetrics(mainFont());\n  QRect textRect = fontMetrics.boundingRect(0, 0, 0, 0, Qt::TextDontClip|mTextAlignment, mText);\n  QRectF textBoxRect = textRect.adjusted(-mPadding.left(), -mPadding.top(), mPadding.right(), mPadding.bottom());\n  QPointF textPos = getTextDrawPoint(QPointF(0, 0), textBoxRect, mPositionAlignment); // 0, 0 because the transform does the translation\n  textBoxRect.moveTopLeft(textPos.toPoint());\n  QPolygonF rectPoly = transform.map(QPolygonF(textBoxRect));\n  \n  switch (anchorId)\n  {\n    case aiTopLeft:     return rectPoly.at(0);\n    case aiTop:         return (rectPoly.at(0)+rectPoly.at(1))*0.5;\n    case aiTopRight:    return rectPoly.at(1);\n    case aiRight:       return (rectPoly.at(1)+rectPoly.at(2))*0.5;\n    case aiBottomRight: return rectPoly.at(2);\n    case aiBottom:      return (rectPoly.at(2)+rectPoly.at(3))*0.5;\n    case aiBottomLeft:  return rectPoly.at(3);\n    case aiLeft:        return (rectPoly.at(3)+rectPoly.at(0))*0.5;\n  }\n  \n  qDebug() << Q_FUNC_INFO << \"invalid anchorId\" << anchorId;\n  return QPointF();\n}\n\n/*! \\internal\n  \n  Returns the point that must be given to the QPainter::drawText function (which expects the top\n  left point of the text rect), according to the position \\a pos, the text bounding box \\a rect and\n  the requested \\a positionAlignment.\n  \n  For example, if \\a positionAlignment is <tt>Qt::AlignLeft | Qt::AlignBottom</tt> the returned point\n  will be shifted upward by the height of \\a rect, starting from \\a pos. So if the text is finally\n  drawn at that point, the lower left corner of the resulting text rect is at \\a pos.\n*/\nQPointF QCPItemText::getTextDrawPoint(const QPointF &pos, const QRectF &rect, Qt::Alignment positionAlignment) const\n{\n  if (positionAlignment == 0 || positionAlignment == (Qt::AlignLeft|Qt::AlignTop))\n    return pos;\n  \n  QPointF result = pos; // start at top left\n  if (positionAlignment.testFlag(Qt::AlignHCenter))\n    result.rx() -= rect.width()/2.0;\n  else if (positionAlignment.testFlag(Qt::AlignRight))\n    result.rx() -= rect.width();\n  if (positionAlignment.testFlag(Qt::AlignVCenter))\n    result.ry() -= rect.height()/2.0;\n  else if (positionAlignment.testFlag(Qt::AlignBottom))\n    result.ry() -= rect.height();\n  return result;\n}\n\n/*! \\internal\n\n  Returns the font that should be used for drawing text. Returns mFont when the item is not selected\n  and mSelectedFont when it is.\n*/\nQFont QCPItemText::mainFont() const\n{\n  return mSelected ? mSelectedFont : mFont;\n}\n\n/*! \\internal\n\n  Returns the color that should be used for drawing text. Returns mColor when the item is not\n  selected and mSelectedColor when it is.\n*/\nQColor QCPItemText::mainColor() const\n{\n  return mSelected ? mSelectedColor : mColor;\n}\n\n/*! \\internal\n\n  Returns the pen that should be used for drawing lines. Returns mPen when the item is not selected\n  and mSelectedPen when it is.\n*/\nQPen QCPItemText::mainPen() const\n{\n  return mSelected ? mSelectedPen : mPen;\n}\n\n/*! \\internal\n\n  Returns the brush that should be used for drawing fills of the item. Returns mBrush when the item\n  is not selected and mSelectedBrush when it is.\n*/\nQBrush QCPItemText::mainBrush() const\n{\n  return mSelected ? mSelectedBrush : mBrush;\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPItemEllipse\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPItemEllipse\n  \\brief An ellipse\n\n  \\image html QCPItemEllipse.png \"Ellipse example. Blue dotted circles are anchors, solid blue discs are positions.\"\n\n  It has two positions, \\a topLeft and \\a bottomRight, which define the rect the ellipse will be drawn in.\n*/\n\n/*!\n  Creates an ellipse item and sets default values.\n  \n  The constructed item can be added to the plot with QCustomPlot::addItem.\n*/\nQCPItemEllipse::QCPItemEllipse(QCustomPlot *parentPlot) :\n  QCPAbstractItem(parentPlot),\n  topLeft(createPosition(\"topLeft\")),\n  bottomRight(createPosition(\"bottomRight\")),\n  topLeftRim(createAnchor(\"topLeftRim\", aiTopLeftRim)),\n  top(createAnchor(\"top\", aiTop)),\n  topRightRim(createAnchor(\"topRightRim\", aiTopRightRim)),\n  right(createAnchor(\"right\", aiRight)),\n  bottomRightRim(createAnchor(\"bottomRightRim\", aiBottomRightRim)),\n  bottom(createAnchor(\"bottom\", aiBottom)),\n  bottomLeftRim(createAnchor(\"bottomLeftRim\", aiBottomLeftRim)),\n  left(createAnchor(\"left\", aiLeft)),\n  center(createAnchor(\"center\", aiCenter))\n{\n  topLeft->setCoords(0, 1);\n  bottomRight->setCoords(1, 0);\n  \n  setPen(QPen(Qt::black));\n  setSelectedPen(QPen(Qt::blue, 2));\n  setBrush(Qt::NoBrush);\n  setSelectedBrush(Qt::NoBrush);\n}\n\nQCPItemEllipse::~QCPItemEllipse()\n{\n}\n\n/*!\n  Sets the pen that will be used to draw the line of the ellipse\n  \n  \\see setSelectedPen, setBrush\n*/\nvoid QCPItemEllipse::setPen(const QPen &pen)\n{\n  mPen = pen;\n}\n\n/*!\n  Sets the pen that will be used to draw the line of the ellipse when selected\n  \n  \\see setPen, setSelected\n*/\nvoid QCPItemEllipse::setSelectedPen(const QPen &pen)\n{\n  mSelectedPen = pen;\n}\n\n/*!\n  Sets the brush that will be used to fill the ellipse. To disable filling, set \\a brush to\n  Qt::NoBrush.\n  \n  \\see setSelectedBrush, setPen\n*/\nvoid QCPItemEllipse::setBrush(const QBrush &brush)\n{\n  mBrush = brush;\n}\n\n/*!\n  Sets the brush that will be used to fill the ellipse when selected. To disable filling, set \\a\n  brush to Qt::NoBrush.\n  \n  \\see setBrush\n*/\nvoid QCPItemEllipse::setSelectedBrush(const QBrush &brush)\n{\n  mSelectedBrush = brush;\n}\n\n/* inherits documentation from base class */\ndouble QCPItemEllipse::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const\n{\n  Q_UNUSED(details)\n  if (onlySelectable && !mSelectable)\n    return -1;\n  \n  double result = -1;\n  QPointF p1 = topLeft->pixelPoint();\n  QPointF p2 = bottomRight->pixelPoint();\n  QPointF center((p1+p2)/2.0);\n  double a = qAbs(p1.x()-p2.x())/2.0;\n  double b = qAbs(p1.y()-p2.y())/2.0;\n  double x = pos.x()-center.x();\n  double y = pos.y()-center.y();\n  \n  // distance to border:\n  double c = 1.0/qSqrt(x*x/(a*a)+y*y/(b*b));\n  result = qAbs(c-1)*qSqrt(x*x+y*y);\n  // filled ellipse, allow click inside to count as hit:\n  if (result > mParentPlot->selectionTolerance()*0.99 && mBrush.style() != Qt::NoBrush && mBrush.color().alpha() != 0)\n  {\n    if (x*x/(a*a) + y*y/(b*b) <= 1)\n      result = mParentPlot->selectionTolerance()*0.99;\n  }\n  return result;\n}\n\n/* inherits documentation from base class */\nvoid QCPItemEllipse::draw(QCPPainter *painter)\n{\n  QPointF p1 = topLeft->pixelPoint();\n  QPointF p2 = bottomRight->pixelPoint();\n  if (p1.toPoint() == p2.toPoint())\n    return;\n  QRectF ellipseRect = QRectF(p1, p2).normalized();\n  QRect clip = clipRect().adjusted(-mainPen().widthF(), -mainPen().widthF(), mainPen().widthF(), mainPen().widthF());\n  if (ellipseRect.intersects(clip)) // only draw if bounding rect of ellipse is visible in cliprect\n  {\n    painter->setPen(mainPen());\n    painter->setBrush(mainBrush());\n#ifdef __EXCEPTIONS\n    try // drawEllipse sometimes throws exceptions if ellipse is too big\n    {\n#endif\n      painter->drawEllipse(ellipseRect);\n#ifdef __EXCEPTIONS\n    } catch (...)\n    {\n      qDebug() << Q_FUNC_INFO << \"Item too large for memory, setting invisible\";\n      setVisible(false);\n    }\n#endif\n  }\n}\n\n/* inherits documentation from base class */\nQPointF QCPItemEllipse::anchorPixelPoint(int anchorId) const\n{\n  QRectF rect = QRectF(topLeft->pixelPoint(), bottomRight->pixelPoint());\n  switch (anchorId)\n  {\n    case aiTopLeftRim:     return rect.center()+(rect.topLeft()-rect.center())*1/qSqrt(2);\n    case aiTop:            return (rect.topLeft()+rect.topRight())*0.5;\n    case aiTopRightRim:    return rect.center()+(rect.topRight()-rect.center())*1/qSqrt(2);\n    case aiRight:          return (rect.topRight()+rect.bottomRight())*0.5;\n    case aiBottomRightRim: return rect.center()+(rect.bottomRight()-rect.center())*1/qSqrt(2);\n    case aiBottom:         return (rect.bottomLeft()+rect.bottomRight())*0.5;\n    case aiBottomLeftRim:  return rect.center()+(rect.bottomLeft()-rect.center())*1/qSqrt(2);\n    case aiLeft:           return (rect.topLeft()+rect.bottomLeft())*0.5;\n    case aiCenter:         return (rect.topLeft()+rect.bottomRight())*0.5;\n  }\n  \n  qDebug() << Q_FUNC_INFO << \"invalid anchorId\" << anchorId;\n  return QPointF();\n}\n\n/*! \\internal\n\n  Returns the pen that should be used for drawing lines. Returns mPen when the item is not selected\n  and mSelectedPen when it is.\n*/\nQPen QCPItemEllipse::mainPen() const\n{\n  return mSelected ? mSelectedPen : mPen;\n}\n\n/*! \\internal\n\n  Returns the brush that should be used for drawing fills of the item. Returns mBrush when the item\n  is not selected and mSelectedBrush when it is.\n*/\nQBrush QCPItemEllipse::mainBrush() const\n{\n  return mSelected ? mSelectedBrush : mBrush;\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPItemPixmap\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPItemPixmap\n  \\brief An arbitrary pixmap\n\n  \\image html QCPItemPixmap.png \"Pixmap example. Blue dotted circles are anchors, solid blue discs are positions.\"\n\n  It has two positions, \\a topLeft and \\a bottomRight, which define the rectangle the pixmap will\n  be drawn in. Depending on the scale setting (\\ref setScaled), the pixmap will be either scaled to\n  fit the rectangle or be drawn aligned to the topLeft position.\n  \n  If scaling is enabled and \\a topLeft is further to the bottom/right than \\a bottomRight (as shown\n  on the right side of the example image), the pixmap will be flipped in the respective\n  orientations.\n*/\n\n/*!\n  Creates a rectangle item and sets default values.\n  \n  The constructed item can be added to the plot with QCustomPlot::addItem.\n*/\nQCPItemPixmap::QCPItemPixmap(QCustomPlot *parentPlot) :\n  QCPAbstractItem(parentPlot),\n  topLeft(createPosition(\"topLeft\")),\n  bottomRight(createPosition(\"bottomRight\")),\n  top(createAnchor(\"top\", aiTop)),\n  topRight(createAnchor(\"topRight\", aiTopRight)),\n  right(createAnchor(\"right\", aiRight)),\n  bottom(createAnchor(\"bottom\", aiBottom)),\n  bottomLeft(createAnchor(\"bottomLeft\", aiBottomLeft)),\n  left(createAnchor(\"left\", aiLeft))\n{\n  topLeft->setCoords(0, 1);\n  bottomRight->setCoords(1, 0);\n  \n  setPen(Qt::NoPen);\n  setSelectedPen(QPen(Qt::blue));\n  setScaled(false, Qt::KeepAspectRatio);\n}\n\nQCPItemPixmap::~QCPItemPixmap()\n{\n}\n\n/*!\n  Sets the pixmap that will be displayed.\n*/\nvoid QCPItemPixmap::setPixmap(const QPixmap &pixmap)\n{\n  mPixmap = pixmap;\n  if (mPixmap.isNull())\n    qDebug() << Q_FUNC_INFO << \"pixmap is null\";\n}\n\n/*!\n  Sets whether the pixmap will be scaled to fit the rectangle defined by the \\a topLeft and \\a\n  bottomRight positions.\n*/\nvoid QCPItemPixmap::setScaled(bool scaled, Qt::AspectRatioMode aspectRatioMode)\n{\n  mScaled = scaled;\n  mAspectRatioMode = aspectRatioMode;\n  updateScaledPixmap();\n}\n\n/*!\n  Sets the pen that will be used to draw a border around the pixmap.\n  \n  \\see setSelectedPen, setBrush\n*/\nvoid QCPItemPixmap::setPen(const QPen &pen)\n{\n  mPen = pen;\n}\n\n/*!\n  Sets the pen that will be used to draw a border around the pixmap when selected\n  \n  \\see setPen, setSelected\n*/\nvoid QCPItemPixmap::setSelectedPen(const QPen &pen)\n{\n  mSelectedPen = pen;\n}\n\n/* inherits documentation from base class */\ndouble QCPItemPixmap::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const\n{\n  Q_UNUSED(details)\n  if (onlySelectable && !mSelectable)\n    return -1;\n  \n  return rectSelectTest(getFinalRect(), pos, true);\n}\n\n/* inherits documentation from base class */\nvoid QCPItemPixmap::draw(QCPPainter *painter)\n{\n  bool flipHorz = false;\n  bool flipVert = false;\n  QRect rect = getFinalRect(&flipHorz, &flipVert);\n  double clipPad = mainPen().style() == Qt::NoPen ? 0 : mainPen().widthF();\n  QRect boundingRect = rect.adjusted(-clipPad, -clipPad, clipPad, clipPad);\n  if (boundingRect.intersects(clipRect()))\n  {\n    updateScaledPixmap(rect, flipHorz, flipVert);\n    painter->drawPixmap(rect.topLeft(), mScaled ? mScaledPixmap : mPixmap);\n    QPen pen = mainPen();\n    if (pen.style() != Qt::NoPen)\n    {\n      painter->setPen(pen);\n      painter->setBrush(Qt::NoBrush);\n      painter->drawRect(rect);\n    }\n  }\n}\n\n/* inherits documentation from base class */\nQPointF QCPItemPixmap::anchorPixelPoint(int anchorId) const\n{\n  bool flipHorz;\n  bool flipVert;\n  QRect rect = getFinalRect(&flipHorz, &flipVert);\n  // we actually want denormal rects (negative width/height) here, so restore\n  // the flipped state:\n  if (flipHorz)\n    rect.adjust(rect.width(), 0, -rect.width(), 0);\n  if (flipVert)\n    rect.adjust(0, rect.height(), 0, -rect.height());\n  \n  switch (anchorId)\n  {\n    case aiTop:         return (rect.topLeft()+rect.topRight())*0.5;\n    case aiTopRight:    return rect.topRight();\n    case aiRight:       return (rect.topRight()+rect.bottomRight())*0.5;\n    case aiBottom:      return (rect.bottomLeft()+rect.bottomRight())*0.5;\n    case aiBottomLeft:  return rect.bottomLeft();\n    case aiLeft:        return (rect.topLeft()+rect.bottomLeft())*0.5;;\n  }\n  \n  qDebug() << Q_FUNC_INFO << \"invalid anchorId\" << anchorId;\n  return QPointF();\n}\n\n/*! \\internal\n  \n  Creates the buffered scaled image (\\a mScaledPixmap) to fit the specified \\a finalRect. The\n  parameters \\a flipHorz and \\a flipVert control whether the resulting image shall be flipped\n  horizontally or vertically. (This is used when \\a topLeft is further to the bottom/right than \\a\n  bottomRight.)\n  \n  This function only creates the scaled pixmap when the buffered pixmap has a different size than\n  the expected result, so calling this function repeatedly, e.g. in the \\ref draw function, does\n  not cause expensive rescaling every time.\n  \n  If scaling is disabled, sets mScaledPixmap to a null QPixmap.\n*/\nvoid QCPItemPixmap::updateScaledPixmap(QRect finalRect, bool flipHorz, bool flipVert)\n{\n  if (mPixmap.isNull())\n    return;\n  \n  if (mScaled)\n  {\n    if (finalRect.isNull())\n      finalRect = getFinalRect(&flipHorz, &flipVert);\n    if (finalRect.size() != mScaledPixmap.size())\n    {\n      mScaledPixmap = mPixmap.scaled(finalRect.size(), mAspectRatioMode, Qt::SmoothTransformation);\n      if (flipHorz || flipVert)\n        mScaledPixmap = QPixmap::fromImage(mScaledPixmap.toImage().mirrored(flipHorz, flipVert));\n    }\n  } else if (!mScaledPixmap.isNull())\n    mScaledPixmap = QPixmap();\n}\n\n/*! \\internal\n  \n  Returns the final (tight) rect the pixmap is drawn in, depending on the current item positions\n  and scaling settings.\n  \n  The output parameters \\a flippedHorz and \\a flippedVert return whether the pixmap should be drawn\n  flipped horizontally or vertically in the returned rect. (The returned rect itself is always\n  normalized, i.e. the top left corner of the rect is actually further to the top/left than the\n  bottom right corner). This is the case when the item position \\a topLeft is further to the\n  bottom/right than \\a bottomRight.\n  \n  If scaling is disabled, returns a rect with size of the original pixmap and the top left corner\n  aligned with the item position \\a topLeft. The position \\a bottomRight is ignored.\n*/\nQRect QCPItemPixmap::getFinalRect(bool *flippedHorz, bool *flippedVert) const\n{\n  QRect result;\n  bool flipHorz = false;\n  bool flipVert = false;\n  QPoint p1 = topLeft->pixelPoint().toPoint();\n  QPoint p2 = bottomRight->pixelPoint().toPoint();\n  if (p1 == p2)\n    return QRect(p1, QSize(0, 0));\n  if (mScaled)\n  {\n    QSize newSize = QSize(p2.x()-p1.x(), p2.y()-p1.y());\n    QPoint topLeft = p1;\n    if (newSize.width() < 0)\n    {\n      flipHorz = true;\n      newSize.rwidth() *= -1;\n      topLeft.setX(p2.x());\n    }\n    if (newSize.height() < 0)\n    {\n      flipVert = true;\n      newSize.rheight() *= -1;\n      topLeft.setY(p2.y());\n    }\n    QSize scaledSize = mPixmap.size();\n    scaledSize.scale(newSize, mAspectRatioMode);\n    result = QRect(topLeft, scaledSize);\n  } else\n  {\n    result = QRect(p1, mPixmap.size());\n  }\n  if (flippedHorz)\n    *flippedHorz = flipHorz;\n  if (flippedVert)\n    *flippedVert = flipVert;\n  return result;\n}\n\n/*! \\internal\n\n  Returns the pen that should be used for drawing lines. Returns mPen when the item is not selected\n  and mSelectedPen when it is.\n*/\nQPen QCPItemPixmap::mainPen() const\n{\n  return mSelected ? mSelectedPen : mPen;\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPItemTracer\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPItemTracer\n  \\brief Item that sticks to QCPGraph data points\n\n  \\image html QCPItemTracer.png \"Tracer example. Blue dotted circles are anchors, solid blue discs are positions.\"\n\n  The tracer can be connected with a QCPGraph via \\ref setGraph. Then it will automatically adopt\n  the coordinate axes of the graph and update its \\a position to be on the graph's data. This means\n  the key stays controllable via \\ref setGraphKey, but the value will follow the graph data. If a\n  QCPGraph is connected, note that setting the coordinates of the tracer item directly via \\a\n  position will have no effect because they will be overriden in the next redraw (this is when the\n  coordinate update happens).\n  \n  If the specified key in \\ref setGraphKey is outside the key bounds of the graph, the tracer will\n  stay at the corresponding end of the graph.\n  \n  With \\ref setInterpolating you may specify whether the tracer may only stay exactly on data\n  points or whether it interpolates data points linearly, if given a key that lies between two data\n  points of the graph.\n  \n  The tracer has different visual styles, see \\ref setStyle. It is also possible to make the tracer\n  have no own visual appearance (set the style to \\ref tsNone), and just connect other item\n  positions to the tracer \\a position (used as an anchor) via \\ref\n  QCPItemPosition::setParentAnchor.\n  \n  \\note The tracer position is only automatically updated upon redraws. So when the data of the\n  graph changes and immediately afterwards (without a redraw) the a position coordinates of the\n  tracer are retrieved, they will not reflect the updated data of the graph. In this case \\ref\n  updatePosition must be called manually, prior to reading the tracer coordinates.\n*/\n\n/*!\n  Creates a tracer item and sets default values.\n  \n  The constructed item can be added to the plot with QCustomPlot::addItem.\n*/\nQCPItemTracer::QCPItemTracer(QCustomPlot *parentPlot) :\n  QCPAbstractItem(parentPlot),\n  position(createPosition(\"position\")),\n  mGraph(0)\n{\n  position->setCoords(0, 0);\n\n  setBrush(Qt::NoBrush);\n  setSelectedBrush(Qt::NoBrush);\n  setPen(QPen(Qt::black));\n  setSelectedPen(QPen(Qt::blue, 2));\n  setStyle(tsCrosshair);\n  setSize(6);\n  setInterpolating(false);\n  setGraphKey(0);\n}\n\nQCPItemTracer::~QCPItemTracer()\n{\n}\n\n/*!\n  Sets the pen that will be used to draw the line of the tracer\n  \n  \\see setSelectedPen, setBrush\n*/\nvoid QCPItemTracer::setPen(const QPen &pen)\n{\n  mPen = pen;\n}\n\n/*!\n  Sets the pen that will be used to draw the line of the tracer when selected\n  \n  \\see setPen, setSelected\n*/\nvoid QCPItemTracer::setSelectedPen(const QPen &pen)\n{\n  mSelectedPen = pen;\n}\n\n/*!\n  Sets the brush that will be used to draw any fills of the tracer\n  \n  \\see setSelectedBrush, setPen\n*/\nvoid QCPItemTracer::setBrush(const QBrush &brush)\n{\n  mBrush = brush;\n}\n\n/*!\n  Sets the brush that will be used to draw any fills of the tracer, when selected.\n  \n  \\see setBrush, setSelected\n*/\nvoid QCPItemTracer::setSelectedBrush(const QBrush &brush)\n{\n  mSelectedBrush = brush;\n}\n\n/*!\n  Sets the size of the tracer in pixels, if the style supports setting a size (e.g. \\ref tsSquare\n  does, \\ref tsCrosshair does not).\n*/\nvoid QCPItemTracer::setSize(double size)\n{\n  mSize = size;\n}\n\n/*!\n  Sets the style/visual appearance of the tracer.\n  \n  If you only want to use the tracer \\a position as an anchor for other items, set \\a style to\n  \\ref tsNone.\n*/\nvoid QCPItemTracer::setStyle(QCPItemTracer::TracerStyle style)\n{\n  mStyle = style;\n}\n\n/*!\n  Sets the QCPGraph this tracer sticks to. The tracer \\a position will be set to type\n  QCPItemPosition::ptPlotCoords and the axes will be set to the axes of \\a graph.\n  \n  To free the tracer from any graph, set \\a graph to 0. The tracer \\a position can then be placed\n  freely like any other item position. This is the state the tracer will assume when its graph gets\n  deleted while still attached to it.\n  \n  \\see setGraphKey\n*/\nvoid QCPItemTracer::setGraph(QCPGraph *graph)\n{\n  if (graph)\n  {\n    if (graph->parentPlot() == mParentPlot)\n    {\n      position->setType(QCPItemPosition::ptPlotCoords);\n      position->setAxes(graph->keyAxis(), graph->valueAxis());\n      mGraph = graph;\n      updatePosition();\n    } else\n      qDebug() << Q_FUNC_INFO << \"graph isn't in same QCustomPlot instance as this item\";\n  } else\n  {\n    mGraph = 0;\n  }\n}\n\n/*!\n  Sets the key of the graph's data point the tracer will be positioned at. This is the only free\n  coordinate of a tracer when attached to a graph.\n  \n  Depending on \\ref setInterpolating, the tracer will be either positioned on the data point\n  closest to \\a key, or will stay exactly at \\a key and interpolate the value linearly.\n  \n  \\see setGraph, setInterpolating\n*/\nvoid QCPItemTracer::setGraphKey(double key)\n{\n  mGraphKey = key;\n}\n\n/*!\n  Sets whether the value of the graph's data points shall be interpolated, when positioning the\n  tracer.\n  \n  If \\a enabled is set to false and a key is given with \\ref setGraphKey, the tracer is placed on\n  the data point of the graph which is closest to the key, but which is not necessarily exactly\n  there. If \\a enabled is true, the tracer will be positioned exactly at the specified key, and\n  the appropriate value will be interpolated from the graph's data points linearly.\n  \n  \\see setGraph, setGraphKey\n*/\nvoid QCPItemTracer::setInterpolating(bool enabled)\n{\n  mInterpolating = enabled;\n}\n\n/* inherits documentation from base class */\ndouble QCPItemTracer::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const\n{\n  Q_UNUSED(details)\n  if (onlySelectable && !mSelectable)\n    return -1;\n\n  QPointF center(position->pixelPoint());\n  double w = mSize/2.0;\n  QRect clip = clipRect();\n  switch (mStyle)\n  {\n    case tsNone: return -1;\n    case tsPlus:\n    {\n      if (clipRect().intersects(QRectF(center-QPointF(w, w), center+QPointF(w, w)).toRect()))\n        return qSqrt(qMin(distSqrToLine(center+QPointF(-w, 0), center+QPointF(w, 0), pos),\n                          distSqrToLine(center+QPointF(0, -w), center+QPointF(0, w), pos)));\n      break;\n    }\n    case tsCrosshair:\n    {\n      return qSqrt(qMin(distSqrToLine(QPointF(clip.left(), center.y()), QPointF(clip.right(), center.y()), pos),\n                        distSqrToLine(QPointF(center.x(), clip.top()), QPointF(center.x(), clip.bottom()), pos)));\n    }\n    case tsCircle:\n    {\n      if (clip.intersects(QRectF(center-QPointF(w, w), center+QPointF(w, w)).toRect()))\n      {\n        // distance to border:\n        double centerDist = QVector2D(center-pos).length();\n        double circleLine = w;\n        double result = qAbs(centerDist-circleLine);\n        // filled ellipse, allow click inside to count as hit:\n        if (result > mParentPlot->selectionTolerance()*0.99 && mBrush.style() != Qt::NoBrush && mBrush.color().alpha() != 0)\n        {\n          if (centerDist <= circleLine)\n            result = mParentPlot->selectionTolerance()*0.99;\n        }\n        return result;\n      }\n      break;\n    }\n    case tsSquare:\n    {\n      if (clip.intersects(QRectF(center-QPointF(w, w), center+QPointF(w, w)).toRect()))\n      {\n        QRectF rect = QRectF(center-QPointF(w, w), center+QPointF(w, w));\n        bool filledRect = mBrush.style() != Qt::NoBrush && mBrush.color().alpha() != 0;\n        return rectSelectTest(rect, pos, filledRect);\n      }\n      break;\n    }\n  }\n  return -1;\n}\n\n/* inherits documentation from base class */\nvoid QCPItemTracer::draw(QCPPainter *painter)\n{\n  updatePosition();\n  if (mStyle == tsNone)\n    return;\n\n  painter->setPen(mainPen());\n  painter->setBrush(mainBrush());\n  QPointF center(position->pixelPoint());\n  double w = mSize/2.0;\n  QRect clip = clipRect();\n  switch (mStyle)\n  {\n    case tsNone: return;\n    case tsPlus:\n    {\n      if (clip.intersects(QRectF(center-QPointF(w, w), center+QPointF(w, w)).toRect()))\n      {\n        painter->drawLine(QLineF(center+QPointF(-w, 0), center+QPointF(w, 0)));\n        painter->drawLine(QLineF(center+QPointF(0, -w), center+QPointF(0, w)));\n      }\n      break;\n    }\n    case tsCrosshair:\n    {\n      if (center.y() > clip.top() && center.y() < clip.bottom())\n        painter->drawLine(QLineF(clip.left(), center.y(), clip.right(), center.y()));\n      if (center.x() > clip.left() && center.x() < clip.right())\n        painter->drawLine(QLineF(center.x(), clip.top(), center.x(), clip.bottom()));\n      break;\n    }\n    case tsCircle:\n    {\n      if (clip.intersects(QRectF(center-QPointF(w, w), center+QPointF(w, w)).toRect()))\n        painter->drawEllipse(center, w, w);\n      break;\n    }\n    case tsSquare:\n    {\n      if (clip.intersects(QRectF(center-QPointF(w, w), center+QPointF(w, w)).toRect()))\n        painter->drawRect(QRectF(center-QPointF(w, w), center+QPointF(w, w)));\n      break;\n    }\n  }\n}\n\n/*!\n  If the tracer is connected with a graph (\\ref setGraph), this function updates the tracer's \\a\n  position to reside on the graph data, depending on the configured key (\\ref setGraphKey).\n  \n  It is called automatically on every redraw and normally doesn't need to be called manually. One\n  exception is when you want to read the tracer coordinates via \\a position and are not sure that\n  the graph's data (or the tracer key with \\ref setGraphKey) hasn't changed since the last redraw.\n  In that situation, call this function before accessing \\a position, to make sure you don't get\n  out-of-date coordinates.\n  \n  If there is no graph set on this tracer, this function does nothing.\n*/\nvoid QCPItemTracer::updatePosition()\n{\n  if (mGraph)\n  {\n    if (mParentPlot->hasPlottable(mGraph))\n    {\n      if (mGraph->data()->size() > 1)\n      {\n        QCPDataMap::const_iterator first = mGraph->data()->constBegin();\n        QCPDataMap::const_iterator last = mGraph->data()->constEnd()-1;\n        if (mGraphKey < first.key())\n          position->setCoords(first.key(), first.value().value);\n        else if (mGraphKey > last.key())\n          position->setCoords(last.key(), last.value().value);\n        else\n        {\n          QCPDataMap::const_iterator it = mGraph->data()->lowerBound(mGraphKey);\n          if (it != first) // mGraphKey is somewhere between iterators\n          {\n            QCPDataMap::const_iterator prevIt = it-1;\n            if (mInterpolating)\n            {\n              // interpolate between iterators around mGraphKey:\n              double slope = 0;\n              if (!qFuzzyCompare((double)it.key(), (double)prevIt.key()))\n                slope = (it.value().value-prevIt.value().value)/(it.key()-prevIt.key());\n              position->setCoords(mGraphKey, (mGraphKey-prevIt.key())*slope+prevIt.value().value);\n            } else\n            {\n              // find iterator with key closest to mGraphKey:\n              if (mGraphKey < (prevIt.key()+it.key())*0.5)\n                it = prevIt;\n              position->setCoords(it.key(), it.value().value);\n            }\n          } else // mGraphKey is exactly on first iterator\n            position->setCoords(it.key(), it.value().value);\n        }\n      } else if (mGraph->data()->size() == 1)\n      {\n        QCPDataMap::const_iterator it = mGraph->data()->constBegin();\n        position->setCoords(it.key(), it.value().value);\n      } else\n        qDebug() << Q_FUNC_INFO << \"graph has no data\";\n    } else\n      qDebug() << Q_FUNC_INFO << \"graph not contained in QCustomPlot instance (anymore)\";\n  }\n}\n\n/*! \\internal\n\n  Returns the pen that should be used for drawing lines. Returns mPen when the item is not selected\n  and mSelectedPen when it is.\n*/\nQPen QCPItemTracer::mainPen() const\n{\n  return mSelected ? mSelectedPen : mPen;\n}\n\n/*! \\internal\n\n  Returns the brush that should be used for drawing fills of the item. Returns mBrush when the item\n  is not selected and mSelectedBrush when it is.\n*/\nQBrush QCPItemTracer::mainBrush() const\n{\n  return mSelected ? mSelectedBrush : mBrush;\n}\n\n\n////////////////////////////////////////////////////////////////////////////////////////////////////\n//////////////////// QCPItemBracket\n////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/*! \\class QCPItemBracket\n  \\brief A bracket for referencing/highlighting certain parts in the plot.\n\n  \\image html QCPItemBracket.png \"Bracket example. Blue dotted circles are anchors, solid blue discs are positions.\"\n\n  It has two positions, \\a left and \\a right, which define the span of the bracket. If \\a left is\n  actually farther to the left than \\a right, the bracket is opened to the bottom, as shown in the\n  example image.\n  \n  The bracket supports multiple styles via \\ref setStyle. The length, i.e. how far the bracket\n  stretches away from the embraced span, can be controlled with \\ref setLength.\n  \n  \\image html QCPItemBracket-length.png\n  <center>Demonstrating the effect of different values for \\ref setLength, for styles \\ref\n  bsCalligraphic and \\ref bsSquare. Anchors and positions are displayed for reference.</center>\n  \n  It provides an anchor \\a center, to allow connection of other items, e.g. an arrow (QCPItemLine\n  or QCPItemCurve) or a text label (QCPItemText), to the bracket.\n*/\n\n/*!\n  Creates a bracket item and sets default values.\n  \n  The constructed item can be added to the plot with QCustomPlot::addItem.\n*/\nQCPItemBracket::QCPItemBracket(QCustomPlot *parentPlot) :\n  QCPAbstractItem(parentPlot),\n  left(createPosition(\"left\")),\n  right(createPosition(\"right\")),\n  center(createAnchor(\"center\", aiCenter))\n{\n  left->setCoords(0, 0);\n  right->setCoords(1, 1);\n  \n  setPen(QPen(Qt::black));\n  setSelectedPen(QPen(Qt::blue, 2));\n  setLength(8);\n  setStyle(bsCalligraphic);\n}\n\nQCPItemBracket::~QCPItemBracket()\n{\n}\n\n/*!\n  Sets the pen that will be used to draw the bracket.\n  \n  Note that when the style is \\ref bsCalligraphic, only the color will be taken from the pen, the\n  stroke and width are ignored. To change the apparent stroke width of a calligraphic bracket, use\n  \\ref setLength, which has a similar effect.\n  \n  \\see setSelectedPen\n*/\nvoid QCPItemBracket::setPen(const QPen &pen)\n{\n  mPen = pen;\n}\n\n/*!\n  Sets the pen that will be used to draw the bracket when selected\n  \n  \\see setPen, setSelected\n*/\nvoid QCPItemBracket::setSelectedPen(const QPen &pen)\n{\n  mSelectedPen = pen;\n}\n\n/*!\n  Sets the \\a length in pixels how far the bracket extends in the direction towards the embraced\n  span of the bracket (i.e. perpendicular to the <i>left</i>-<i>right</i>-direction)\n  \n  \\image html QCPItemBracket-length.png\n  <center>Demonstrating the effect of different values for \\ref setLength, for styles \\ref\n  bsCalligraphic and \\ref bsSquare. Anchors and positions are displayed for reference.</center>\n*/\nvoid QCPItemBracket::setLength(double length)\n{\n  mLength = length;\n}\n\n/*!\n  Sets the style of the bracket, i.e. the shape/visual appearance.\n  \n  \\see setPen\n*/\nvoid QCPItemBracket::setStyle(QCPItemBracket::BracketStyle style)\n{\n  mStyle = style;\n}\n\n/* inherits documentation from base class */\ndouble QCPItemBracket::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const\n{\n  Q_UNUSED(details)\n  if (onlySelectable && !mSelectable)\n    return -1;\n  \n  QVector2D leftVec(left->pixelPoint());\n  QVector2D rightVec(right->pixelPoint());\n  if (leftVec.toPoint() == rightVec.toPoint())\n    return -1;\n  \n  QVector2D widthVec = (rightVec-leftVec)*0.5f;\n  QVector2D lengthVec(-widthVec.y(), widthVec.x());\n  lengthVec = lengthVec.normalized()*mLength;\n  QVector2D centerVec = (rightVec+leftVec)*0.5f-lengthVec;\n  \n  return qSqrt(distSqrToLine((centerVec-widthVec).toPointF(), (centerVec+widthVec).toPointF(), pos));\n}\n\n/* inherits documentation from base class */\nvoid QCPItemBracket::draw(QCPPainter *painter)\n{\n  QVector2D leftVec(left->pixelPoint());\n  QVector2D rightVec(right->pixelPoint());\n  if (leftVec.toPoint() == rightVec.toPoint())\n    return;\n  \n  QVector2D widthVec = (rightVec-leftVec)*0.5f;\n  QVector2D lengthVec(-widthVec.y(), widthVec.x());\n  lengthVec = lengthVec.normalized()*mLength;\n  QVector2D centerVec = (rightVec+leftVec)*0.5f-lengthVec;\n\n  QPolygon boundingPoly;\n  boundingPoly << leftVec.toPoint() << rightVec.toPoint()\n               << (rightVec-lengthVec).toPoint() << (leftVec-lengthVec).toPoint();\n  QRect clip = clipRect().adjusted(-mainPen().widthF(), -mainPen().widthF(), mainPen().widthF(), mainPen().widthF());\n  if (clip.intersects(boundingPoly.boundingRect()))\n  {\n    painter->setPen(mainPen());\n    switch (mStyle)\n    {\n      case bsSquare:\n      {\n        painter->drawLine((centerVec+widthVec).toPointF(), (centerVec-widthVec).toPointF());\n        painter->drawLine((centerVec+widthVec).toPointF(), (centerVec+widthVec+lengthVec).toPointF());\n        painter->drawLine((centerVec-widthVec).toPointF(), (centerVec-widthVec+lengthVec).toPointF());\n        break;\n      }\n      case bsRound:\n      {\n        painter->setBrush(Qt::NoBrush);\n        QPainterPath path;\n        path.moveTo((centerVec+widthVec+lengthVec).toPointF());\n        path.cubicTo((centerVec+widthVec).toPointF(), (centerVec+widthVec).toPointF(), centerVec.toPointF());\n        path.cubicTo((centerVec-widthVec).toPointF(), (centerVec-widthVec).toPointF(), (centerVec-widthVec+lengthVec).toPointF());\n        painter->drawPath(path);\n        break;\n      }\n      case bsCurly:\n      {\n        painter->setBrush(Qt::NoBrush);\n        QPainterPath path;\n        path.moveTo((centerVec+widthVec+lengthVec).toPointF());\n        path.cubicTo((centerVec+widthVec-lengthVec*0.8f).toPointF(), (centerVec+0.4f*widthVec+lengthVec).toPointF(), centerVec.toPointF());\n        path.cubicTo((centerVec-0.4f*widthVec+lengthVec).toPointF(), (centerVec-widthVec-lengthVec*0.8f).toPointF(), (centerVec-widthVec+lengthVec).toPointF());\n        painter->drawPath(path);\n        break;\n      }\n      case bsCalligraphic:\n      {\n        painter->setPen(Qt::NoPen);\n        painter->setBrush(QBrush(mainPen().color()));\n        QPainterPath path;\n        path.moveTo((centerVec+widthVec+lengthVec).toPointF());\n        \n        path.cubicTo((centerVec+widthVec-lengthVec*0.8f).toPointF(), (centerVec+0.4f*widthVec+0.8f*lengthVec).toPointF(), centerVec.toPointF());\n        path.cubicTo((centerVec-0.4f*widthVec+0.8f*lengthVec).toPointF(), (centerVec-widthVec-lengthVec*0.8f).toPointF(), (centerVec-widthVec+lengthVec).toPointF());\n        \n        path.cubicTo((centerVec-widthVec-lengthVec*0.5f).toPointF(), (centerVec-0.2f*widthVec+1.2f*lengthVec).toPointF(), (centerVec+lengthVec*0.2f).toPointF());\n        path.cubicTo((centerVec+0.2f*widthVec+1.2f*lengthVec).toPointF(), (centerVec+widthVec-lengthVec*0.5f).toPointF(), (centerVec+widthVec+lengthVec).toPointF());\n        \n        painter->drawPath(path);\n        break;\n      }\n    }\n  }\n}\n\n/* inherits documentation from base class */\nQPointF QCPItemBracket::anchorPixelPoint(int anchorId) const\n{\n  QVector2D leftVec(left->pixelPoint());\n  QVector2D rightVec(right->pixelPoint());\n  if (leftVec.toPoint() == rightVec.toPoint())\n    return leftVec.toPointF();\n  \n  QVector2D widthVec = (rightVec-leftVec)*0.5f;\n  QVector2D lengthVec(-widthVec.y(), widthVec.x());\n  lengthVec = lengthVec.normalized()*mLength;\n  QVector2D centerVec = (rightVec+leftVec)*0.5f-lengthVec;\n  \n  switch (anchorId)\n  {\n    case aiCenter:\n      return centerVec.toPointF();\n  }\n  qDebug() << Q_FUNC_INFO << \"invalid anchorId\" << anchorId;\n  return QPointF();\n}\n\n/*! \\internal\n\n  Returns the pen that should be used for drawing lines. Returns mPen when the\n  item is not selected and mSelectedPen when it is.\n*/\nQPen QCPItemBracket::mainPen() const\n{\n    return mSelected ? mSelectedPen : mPen;\n}\n\n"
  },
  {
    "path": "DynamicAudioNormalizerGUI/src/3rd_party/qcustomplot.h",
    "content": "/***************************************************************************\n**                                                                        **\n**  QCustomPlot, an easy to use, modern plotting widget for Qt            **\n**  Copyright (C) 2011, 2012, 2013, 2014 Emanuel Eichhammer               **\n**                                                                        **\n**  This program is free software: you can redistribute it and/or modify  **\n**  it under the terms of the GNU General Public License as published by  **\n**  the Free Software Foundation, either version 3 of the License, or     **\n**  (at your option) any later version.                                   **\n**                                                                        **\n**  This program is distributed in the hope that it will be useful,       **\n**  but WITHOUT ANY WARRANTY; without even the implied warranty of        **\n**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         **\n**  GNU General Public License for more details.                          **\n**                                                                        **\n**  You should have received a copy of the GNU General Public License     **\n**  along with this program.  If not, see http://www.gnu.org/licenses/.   **\n**                                                                        **\n****************************************************************************\n**           Author: Emanuel Eichhammer                                   **\n**  Website/Contact: http://www.qcustomplot.com/                          **\n**             Date: 07.04.14                                             **\n**          Version: 1.2.1                                                **\n****************************************************************************/\n\n#ifndef QCUSTOMPLOT_H\n#define QCUSTOMPLOT_H\n\n#include <QObject>\n#include <QPointer>\n#include <QWidget>\n#include <QPainter>\n#include <QPaintEvent>\n#include <QMouseEvent>\n#include <QPixmap>\n#include <QVector>\n#include <QString>\n#include <QDateTime>\n#include <QMultiMap>\n#include <QFlags>\n#include <QDebug>\n#include <QVector2D>\n#include <QStack>\n#include <QCache>\n#include <QMargins>\n#include <qmath.h>\n#include <limits>\n#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)\n#  include <qnumeric.h>\n#  include <QPrinter>\n#  include <QPrintEngine>\n#else\n#  include <QtNumeric>\n#  include <QtPrintSupport>\n#endif\n\nclass QCPPainter;\nclass QCustomPlot;\nclass QCPLayerable;\nclass QCPLayoutElement;\nclass QCPLayout;\nclass QCPAxis;\nclass QCPAxisRect;\nclass QCPAxisPainterPrivate;\nclass QCPAbstractPlottable;\nclass QCPGraph;\nclass QCPAbstractItem;\nclass QCPItemPosition;\nclass QCPLayer;\nclass QCPPlotTitle;\nclass QCPLegend;\nclass QCPAbstractLegendItem;\nclass QCPColorMap;\nclass QCPColorScale;\n\n\n/*! \\file */\n\n\n// decl definitions for shared library compilation/usage:\n#if defined(QCUSTOMPLOT_COMPILE_LIBRARY)\n#  define QCP_LIB_DECL Q_DECL_EXPORT\n#elif defined(QCUSTOMPLOT_USE_LIBRARY)\n#  define QCP_LIB_DECL Q_DECL_IMPORT\n#else\n#  define QCP_LIB_DECL\n#endif\n\n/*!\n  The QCP Namespace contains general enums and QFlags used throughout the QCustomPlot library\n*/\nnamespace QCP\n{\n/*!\n  Defines the sides of a rectangular entity to which margins can be applied.\n  \n  \\see QCPLayoutElement::setAutoMargins, QCPAxisRect::setAutoMargins\n*/\nenum MarginSide { msLeft     = 0x01 ///< <tt>0x01</tt> left margin\n                  ,msRight   = 0x02 ///< <tt>0x02</tt> right margin\n                  ,msTop     = 0x04 ///< <tt>0x04</tt> top margin\n                  ,msBottom  = 0x08 ///< <tt>0x08</tt> bottom margin\n                  ,msAll     = 0xFF ///< <tt>0xFF</tt> all margins\n                  ,msNone    = 0x00 ///< <tt>0x00</tt> no margin\n                };\nQ_DECLARE_FLAGS(MarginSides, MarginSide)\n\n/*!\n  Defines what objects of a plot can be forcibly drawn antialiased/not antialiased. If an object is\n  neither forcibly drawn antialiased nor forcibly drawn not antialiased, it is up to the respective\n  element how it is drawn. Typically it provides a \\a setAntialiased function for this.\n  \n  \\c AntialiasedElements is a flag of or-combined elements of this enum type.\n  \n  \\see QCustomPlot::setAntialiasedElements, QCustomPlot::setNotAntialiasedElements\n*/\nenum AntialiasedElement { aeAxes           = 0x0001 ///< <tt>0x0001</tt> Axis base line and tick marks\n                          ,aeGrid          = 0x0002 ///< <tt>0x0002</tt> Grid lines\n                          ,aeSubGrid       = 0x0004 ///< <tt>0x0004</tt> Sub grid lines\n                          ,aeLegend        = 0x0008 ///< <tt>0x0008</tt> Legend box\n                          ,aeLegendItems   = 0x0010 ///< <tt>0x0010</tt> Legend items\n                          ,aePlottables    = 0x0020 ///< <tt>0x0020</tt> Main lines of plottables (excluding error bars, see element \\ref aeErrorBars)\n                          ,aeItems         = 0x0040 ///< <tt>0x0040</tt> Main lines of items\n                          ,aeScatters      = 0x0080 ///< <tt>0x0080</tt> Scatter symbols of plottables (excluding scatter symbols of type ssPixmap)\n                          ,aeErrorBars     = 0x0100 ///< <tt>0x0100</tt> Error bars\n                          ,aeFills         = 0x0200 ///< <tt>0x0200</tt> Borders of fills (e.g. under or between graphs)\n                          ,aeZeroLine      = 0x0400 ///< <tt>0x0400</tt> Zero-lines, see \\ref QCPGrid::setZeroLinePen\n                          ,aeAll           = 0xFFFF ///< <tt>0xFFFF</tt> All elements\n                          ,aeNone          = 0x0000 ///< <tt>0x0000</tt> No elements\n                        };\nQ_DECLARE_FLAGS(AntialiasedElements, AntialiasedElement)\n\n/*!\n  Defines plotting hints that control various aspects of the quality and speed of plotting.\n  \n  \\see QCustomPlot::setPlottingHints\n*/\nenum PlottingHint { phNone            = 0x000 ///< <tt>0x000</tt> No hints are set\n                    ,phFastPolylines  = 0x001 ///< <tt>0x001</tt> Graph/Curve lines are drawn with a faster method. This reduces the quality\n                                              ///<                especially of the line segment joins. (Only relevant for solid line pens.)\n                    ,phForceRepaint   = 0x002 ///< <tt>0x002</tt> causes an immediate repaint() instead of a soft update() when QCustomPlot::replot() is called with parameter \\ref QCustomPlot::rpHint.\n                                              ///<                This is set by default to prevent the plot from freezing on fast consecutive replots (e.g. user drags ranges with mouse).\n                    ,phCacheLabels    = 0x004 ///< <tt>0x004</tt> axis (tick) labels will be cached as pixmaps, increasing replot performance.\n                  };\nQ_DECLARE_FLAGS(PlottingHints, PlottingHint)\n\n/*!\n  Defines the mouse interactions possible with QCustomPlot.\n  \n  \\c Interactions is a flag of or-combined elements of this enum type.\n  \n  \\see QCustomPlot::setInteractions\n*/\nenum Interaction { iRangeDrag         = 0x001 ///< <tt>0x001</tt> Axis ranges are draggable (see \\ref QCPAxisRect::setRangeDrag, \\ref QCPAxisRect::setRangeDragAxes)\n                   ,iRangeZoom        = 0x002 ///< <tt>0x002</tt> Axis ranges are zoomable with the mouse wheel (see \\ref QCPAxisRect::setRangeZoom, \\ref QCPAxisRect::setRangeZoomAxes)\n                   ,iMultiSelect      = 0x004 ///< <tt>0x004</tt> The user can select multiple objects by holding the modifier set by \\ref QCustomPlot::setMultiSelectModifier while clicking\n                   ,iSelectPlottables = 0x008 ///< <tt>0x008</tt> Plottables are selectable (e.g. graphs, curves, bars,... see QCPAbstractPlottable)\n                   ,iSelectAxes       = 0x010 ///< <tt>0x010</tt> Axes are selectable (or parts of them, see QCPAxis::setSelectableParts)\n                   ,iSelectLegend     = 0x020 ///< <tt>0x020</tt> Legends are selectable (or their child items, see QCPLegend::setSelectableParts)\n                   ,iSelectItems      = 0x040 ///< <tt>0x040</tt> Items are selectable (Rectangles, Arrows, Textitems, etc. see \\ref QCPAbstractItem)\n                   ,iSelectOther      = 0x080 ///< <tt>0x080</tt> All other objects are selectable (e.g. your own derived layerables, the plot title,...)\n                 };\nQ_DECLARE_FLAGS(Interactions, Interaction)\n\n/*! \\internal\n  \n  Returns whether the specified \\a value is considered an invalid data value for plottables (i.e.\n  is \\e nan or \\e +/-inf). This function is used to check data validity upon replots, when the\n  compiler flag \\c QCUSTOMPLOT_CHECK_DATA is set.\n*/\ninline bool isInvalidData(double value)\n{\n  return qIsNaN(value) || qIsInf(value);\n}\n\n/*! \\internal\n  \\overload\n  \n  Checks two arguments instead of one.\n*/\ninline bool isInvalidData(double value1, double value2)\n{\n  return isInvalidData(value1) || isInvalidData(value2);\n}\n\n/*! \\internal\n  \n  Sets the specified \\a side of \\a margins to \\a value\n  \n  \\see getMarginValue\n*/\ninline void setMarginValue(QMargins &margins, QCP::MarginSide side, int value)\n{\n  switch (side)\n  {\n    case QCP::msLeft: margins.setLeft(value); break;\n    case QCP::msRight: margins.setRight(value); break;\n    case QCP::msTop: margins.setTop(value); break;\n    case QCP::msBottom: margins.setBottom(value); break;\n    case QCP::msAll: margins = QMargins(value, value, value, value); break;\n    default: break;\n  }\n}\n\n/*! \\internal\n  \n  Returns the value of the specified \\a side of \\a margins. If \\a side is \\ref QCP::msNone or\n  \\ref QCP::msAll, returns 0.\n  \n  \\see setMarginValue\n*/\ninline int getMarginValue(const QMargins &margins, QCP::MarginSide side)\n{\n  switch (side)\n  {\n    case QCP::msLeft: return margins.left();\n    case QCP::msRight: return margins.right();\n    case QCP::msTop: return margins.top();\n    case QCP::msBottom: return margins.bottom();\n    default: break;\n  }\n  return 0;\n}\n\n} // end of namespace QCP\n\nQ_DECLARE_OPERATORS_FOR_FLAGS(QCP::AntialiasedElements)\nQ_DECLARE_OPERATORS_FOR_FLAGS(QCP::PlottingHints)\nQ_DECLARE_OPERATORS_FOR_FLAGS(QCP::MarginSides)\nQ_DECLARE_OPERATORS_FOR_FLAGS(QCP::Interactions)\n\n\nclass QCP_LIB_DECL QCPScatterStyle\n{\n  Q_GADGET\npublic:\n  /*!\n    Defines the shape used for scatter points.\n\n    On plottables/items that draw scatters, the sizes of these visualizations (with exception of\n    \\ref ssDot and \\ref ssPixmap) can be controlled with the \\ref setSize function. Scatters are\n    drawn with the pen and brush specified with \\ref setPen and \\ref setBrush.\n  */\n  Q_ENUMS(ScatterShape)\n  enum ScatterShape { ssNone       ///< no scatter symbols are drawn (e.g. in QCPGraph, data only represented with lines)\n                      ,ssDot       ///< \\enumimage{ssDot.png} a single pixel (use \\ref ssDisc or \\ref ssCircle if you want a round shape with a certain radius)\n                      ,ssCross     ///< \\enumimage{ssCross.png} a cross\n                      ,ssPlus      ///< \\enumimage{ssPlus.png} a plus\n                      ,ssCircle    ///< \\enumimage{ssCircle.png} a circle\n                      ,ssDisc      ///< \\enumimage{ssDisc.png} a circle which is filled with the pen's color (not the brush as with ssCircle)\n                      ,ssSquare    ///< \\enumimage{ssSquare.png} a square\n                      ,ssDiamond   ///< \\enumimage{ssDiamond.png} a diamond\n                      ,ssStar      ///< \\enumimage{ssStar.png} a star with eight arms, i.e. a combination of cross and plus\n                      ,ssTriangle  ///< \\enumimage{ssTriangle.png} an equilateral triangle, standing on baseline\n                      ,ssTriangleInverted ///< \\enumimage{ssTriangleInverted.png} an equilateral triangle, standing on corner\n                      ,ssCrossSquare      ///< \\enumimage{ssCrossSquare.png} a square with a cross inside\n                      ,ssPlusSquare       ///< \\enumimage{ssPlusSquare.png} a square with a plus inside\n                      ,ssCrossCircle      ///< \\enumimage{ssCrossCircle.png} a circle with a cross inside\n                      ,ssPlusCircle       ///< \\enumimage{ssPlusCircle.png} a circle with a plus inside\n                      ,ssPeace     ///< \\enumimage{ssPeace.png} a circle, with one vertical and two downward diagonal lines\n                      ,ssPixmap    ///< a custom pixmap specified by \\ref setPixmap, centered on the data point coordinates\n                      ,ssCustom    ///< custom painter operations are performed per scatter (As QPainterPath, see \\ref setCustomPath)\n                    };\n\n  QCPScatterStyle();\n  QCPScatterStyle(ScatterShape shape, double size=6);\n  QCPScatterStyle(ScatterShape shape, const QColor &color, double size);\n  QCPScatterStyle(ScatterShape shape, const QColor &color, const QColor &fill, double size);\n  QCPScatterStyle(ScatterShape shape, const QPen &pen, const QBrush &brush, double size);\n  QCPScatterStyle(const QPixmap &pixmap);\n  QCPScatterStyle(const QPainterPath &customPath, const QPen &pen, const QBrush &brush=Qt::NoBrush, double size=6);\n  \n  // getters:\n  double size() const { return mSize; }\n  ScatterShape shape() const { return mShape; }\n  QPen pen() const { return mPen; }\n  QBrush brush() const { return mBrush; }\n  QPixmap pixmap() const { return mPixmap; }\n  QPainterPath customPath() const { return mCustomPath; }\n\n  // setters:\n  void setSize(double size);\n  void setShape(ScatterShape shape);\n  void setPen(const QPen &pen);\n  void setBrush(const QBrush &brush);\n  void setPixmap(const QPixmap &pixmap);\n  void setCustomPath(const QPainterPath &customPath);\n\n  // non-property methods:\n  bool isNone() const { return mShape == ssNone; }\n  bool isPenDefined() const { return mPenDefined; }\n  void applyTo(QCPPainter *painter, const QPen &defaultPen) const;\n  void drawShape(QCPPainter *painter, QPointF pos) const;\n  void drawShape(QCPPainter *painter, double x, double y) const;\n\nprotected:\n  // property members:\n  double mSize;\n  ScatterShape mShape;\n  QPen mPen;\n  QBrush mBrush;\n  QPixmap mPixmap;\n  QPainterPath mCustomPath;\n  \n  // non-property members:\n  bool mPenDefined;\n};\nQ_DECLARE_TYPEINFO(QCPScatterStyle, Q_MOVABLE_TYPE);\n\n\nclass QCP_LIB_DECL QCPPainter : public QPainter\n{\n  Q_GADGET\npublic:\n  /*!\n    Defines special modes the painter can operate in. They disable or enable certain subsets of features/fixes/workarounds,\n    depending on whether they are wanted on the respective output device.\n  */\n  enum PainterMode { pmDefault       = 0x00   ///< <tt>0x00</tt> Default mode for painting on screen devices\n                     ,pmVectorized   = 0x01   ///< <tt>0x01</tt> Mode for vectorized painting (e.g. PDF export). For example, this prevents some antialiasing fixes.\n                     ,pmNoCaching    = 0x02   ///< <tt>0x02</tt> Mode for all sorts of exports (e.g. PNG, PDF,...). For example, this prevents using cached pixmap labels\n                     ,pmNonCosmetic  = 0x04   ///< <tt>0x04</tt> Turns pen widths 0 to 1, i.e. disables cosmetic pens. (A cosmetic pen is always drawn with width 1 pixel in the vector image/pdf viewer, independent of zoom.)\n                   };\n  Q_FLAGS(PainterMode PainterModes)\n  Q_DECLARE_FLAGS(PainterModes, PainterMode)\n  \n  QCPPainter();\n  QCPPainter(QPaintDevice *device);\n  ~QCPPainter();\n  \n  // getters:\n  bool antialiasing() const { return testRenderHint(QPainter::Antialiasing); }\n  PainterModes modes() const { return mModes; }\n\n  // setters:\n  void setAntialiasing(bool enabled);\n  void setMode(PainterMode mode, bool enabled=true);\n  void setModes(PainterModes modes);\n\n  // methods hiding non-virtual base class functions (QPainter bug workarounds):\n  bool begin(QPaintDevice *device);\n  void setPen(const QPen &pen);\n  void setPen(const QColor &color);\n  void setPen(Qt::PenStyle penStyle);\n  void drawLine(const QLineF &line);\n  void drawLine(const QPointF &p1, const QPointF &p2) {drawLine(QLineF(p1, p2));}\n  void save();\n  void restore();\n  \n  // non-virtual methods:\n  void makeNonCosmetic();\n  \nprotected:\n  // property members:\n  PainterModes mModes;\n  bool mIsAntialiasing;\n  \n  // non-property members:\n  QStack<bool> mAntialiasingStack;\n};\nQ_DECLARE_OPERATORS_FOR_FLAGS(QCPPainter::PainterModes)\n\n\nclass QCP_LIB_DECL QCPLayer : public QObject\n{\n  Q_OBJECT\n  /// \\cond INCLUDE_QPROPERTIES\n  Q_PROPERTY(QCustomPlot* parentPlot READ parentPlot)\n  Q_PROPERTY(QString name READ name)\n  Q_PROPERTY(int index READ index)\n  Q_PROPERTY(QList<QCPLayerable*> children READ children)\n  Q_PROPERTY(bool visible READ visible WRITE setVisible)\n  /// \\endcond\npublic:\n  QCPLayer(QCustomPlot* parentPlot, const QString &layerName);\n  ~QCPLayer();\n  \n  // getters:\n  QCustomPlot *parentPlot() const { return mParentPlot; }\n  QString name() const { return mName; }\n  int index() const { return mIndex; }\n  QList<QCPLayerable*> children() const { return mChildren; }\n  bool visible() const { return mVisible; }\n  \n  // setters:\n  void setVisible(bool visible);\n  \nprotected:\n  // property members:\n  QCustomPlot *mParentPlot;\n  QString mName;\n  int mIndex;\n  QList<QCPLayerable*> mChildren;\n  bool mVisible;\n  \n  // non-virtual methods:\n  void addChild(QCPLayerable *layerable, bool prepend);\n  void removeChild(QCPLayerable *layerable);\n  \nprivate:\n  Q_DISABLE_COPY(QCPLayer)\n  \n  friend class QCustomPlot;\n  friend class QCPLayerable;\n};\n\nclass QCP_LIB_DECL QCPLayerable : public QObject\n{\n  Q_OBJECT\n  /// \\cond INCLUDE_QPROPERTIES\n  Q_PROPERTY(bool visible READ visible WRITE setVisible)\n  Q_PROPERTY(QCustomPlot* parentPlot READ parentPlot)\n  Q_PROPERTY(QCPLayerable* parentLayerable READ parentLayerable)\n  Q_PROPERTY(QCPLayer* layer READ layer WRITE setLayer NOTIFY layerChanged)\n  Q_PROPERTY(bool antialiased READ antialiased WRITE setAntialiased)\n  /// \\endcond\npublic:\n  QCPLayerable(QCustomPlot *plot, QString targetLayer=\"\", QCPLayerable *parentLayerable=0);\n  ~QCPLayerable();\n  \n  // getters:\n  bool visible() const { return mVisible; }\n  QCustomPlot *parentPlot() const { return mParentPlot; }\n  QCPLayerable *parentLayerable() const { return mParentLayerable.data(); }\n  QCPLayer *layer() const { return mLayer; }\n  bool antialiased() const { return mAntialiased; }\n  \n  // setters:\n  void setVisible(bool on);\n  Q_SLOT bool setLayer(QCPLayer *layer);\n  bool setLayer(const QString &layerName);\n  void setAntialiased(bool enabled);\n  \n  // introduced virtual methods:\n  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;\n  \n  // non-property methods:\n  bool realVisibility() const;\n  \nsignals:\n  void layerChanged(QCPLayer *newLayer);\n  \nprotected:\n  // property members:\n  bool mVisible;\n  QCustomPlot *mParentPlot;\n  QPointer<QCPLayerable> mParentLayerable;\n  QCPLayer *mLayer;\n  bool mAntialiased;\n  \n  // introduced virtual methods:\n  virtual void parentPlotInitialized(QCustomPlot *parentPlot);\n  virtual QCP::Interaction selectionCategory() const;\n  virtual QRect clipRect() const;\n  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const = 0;\n  virtual void draw(QCPPainter *painter) = 0;\n  // events:\n  virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);\n  virtual void deselectEvent(bool *selectionStateChanged);\n  \n  // non-property methods:\n  void initializeParentPlot(QCustomPlot *parentPlot);\n  void setParentLayerable(QCPLayerable* parentLayerable);\n  bool moveToLayer(QCPLayer *layer, bool prepend);\n  void applyAntialiasingHint(QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const;\n  \nprivate:\n  Q_DISABLE_COPY(QCPLayerable)\n  \n  friend class QCustomPlot;\n  friend class QCPAxisRect;\n};\n\n\nclass QCP_LIB_DECL QCPRange\n{\npublic:\n  double lower, upper;\n  \n  QCPRange();\n  QCPRange(double lower, double upper);\n  \n  bool operator==(const QCPRange& other) { return lower == other.lower && upper == other.upper; }\n  bool operator!=(const QCPRange& other) { return !(*this == other); }\n  \n  QCPRange &operator+=(const double& value) { lower+=value; upper+=value; return *this; }\n  QCPRange &operator-=(const double& value) { lower-=value; upper-=value; return *this; }\n  QCPRange &operator*=(const double& value) { lower*=value; upper*=value; return *this; }\n  QCPRange &operator/=(const double& value) { lower/=value; upper/=value; return *this; }\n  friend inline const QCPRange operator+(const QCPRange&, double);\n  friend inline const QCPRange operator+(double, const QCPRange&);\n  friend inline const QCPRange operator-(const QCPRange& range, double value);\n  friend inline const QCPRange operator*(const QCPRange& range, double value);\n  friend inline const QCPRange operator*(double value, const QCPRange& range);\n  friend inline const QCPRange operator/(const QCPRange& range, double value);\n  \n  double size() const;\n  double center() const;\n  void normalize();\n  void expand(const QCPRange &otherRange);\n  QCPRange expanded(const QCPRange &otherRange) const;\n  QCPRange sanitizedForLogScale() const;\n  QCPRange sanitizedForLinScale() const;\n  bool contains(double value) const;\n  \n  static bool validRange(double lower, double upper);\n  static bool validRange(const QCPRange &range);\n  static const double minRange; //1e-280;\n  static const double maxRange; //1e280;\n  \n};\nQ_DECLARE_TYPEINFO(QCPRange, Q_MOVABLE_TYPE);\n\n/* documentation of inline functions */\n\n/*! \\fn QCPRange &QCPRange::operator+=(const double& value)\n  \n  Adds \\a value to both boundaries of the range.\n*/\n\n/*! \\fn QCPRange &QCPRange::operator-=(const double& value)\n  \n  Subtracts \\a value from both boundaries of the range.\n*/\n\n/*! \\fn QCPRange &QCPRange::operator*=(const double& value)\n  \n  Multiplies both boundaries of the range by \\a value.\n*/\n\n/*! \\fn QCPRange &QCPRange::operator/=(const double& value)\n  \n  Divides both boundaries of the range by \\a value.\n*/\n\n/* end documentation of inline functions */\n\n/*!\n  Adds \\a value to both boundaries of the range.\n*/\ninline const QCPRange operator+(const QCPRange& range, double value)\n{\n  QCPRange result(range);\n  result += value;\n  return result;\n}\n\n/*!\n  Adds \\a value to both boundaries of the range.\n*/\ninline const QCPRange operator+(double value, const QCPRange& range)\n{\n  QCPRange result(range);\n  result += value;\n  return result;\n}\n\n/*!\n  Subtracts \\a value from both boundaries of the range.\n*/\ninline const QCPRange operator-(const QCPRange& range, double value)\n{\n  QCPRange result(range);\n  result -= value;\n  return result;\n}\n\n/*!\n  Multiplies both boundaries of the range by \\a value.\n*/\ninline const QCPRange operator*(const QCPRange& range, double value)\n{\n  QCPRange result(range);\n  result *= value;\n  return result;\n}\n\n/*!\n  Multiplies both boundaries of the range by \\a value.\n*/\ninline const QCPRange operator*(double value, const QCPRange& range)\n{\n  QCPRange result(range);\n  result *= value;\n  return result;\n}\n\n/*!\n  Divides both boundaries of the range by \\a value.\n*/\ninline const QCPRange operator/(const QCPRange& range, double value)\n{\n  QCPRange result(range);\n  result /= value;\n  return result;\n}\n\n\nclass QCP_LIB_DECL QCPMarginGroup : public QObject\n{\n  Q_OBJECT\npublic:\n  QCPMarginGroup(QCustomPlot *parentPlot);\n  ~QCPMarginGroup();\n  \n  // non-virtual methods:\n  QList<QCPLayoutElement*> elements(QCP::MarginSide side) const { return mChildren.value(side); }\n  bool isEmpty() const;\n  void clear();\n  \nprotected:\n  // non-property members:\n  QCustomPlot *mParentPlot;\n  QHash<QCP::MarginSide, QList<QCPLayoutElement*> > mChildren;\n  \n  // non-virtual methods:\n  int commonMargin(QCP::MarginSide side) const;\n  void addChild(QCP::MarginSide side, QCPLayoutElement *element);\n  void removeChild(QCP::MarginSide side, QCPLayoutElement *element);\n  \nprivate:\n  Q_DISABLE_COPY(QCPMarginGroup)\n  \n  friend class QCPLayoutElement;\n};\n\n\nclass QCP_LIB_DECL QCPLayoutElement : public QCPLayerable\n{\n  Q_OBJECT\n  /// \\cond INCLUDE_QPROPERTIES\n  Q_PROPERTY(QCPLayout* layout READ layout)\n  Q_PROPERTY(QRect rect READ rect)\n  Q_PROPERTY(QRect outerRect READ outerRect WRITE setOuterRect)\n  Q_PROPERTY(QMargins margins READ margins WRITE setMargins)\n  Q_PROPERTY(QMargins minimumMargins READ minimumMargins WRITE setMinimumMargins)\n  Q_PROPERTY(QSize minimumSize READ minimumSize WRITE setMinimumSize)\n  Q_PROPERTY(QSize maximumSize READ maximumSize WRITE setMaximumSize)\n  /// \\endcond\npublic:\n  /*!\n    Defines the phases of the update process, that happens just before a replot. At each phase,\n    \\ref update is called with the according UpdatePhase value.\n  */\n  enum UpdatePhase { upPreparation ///< Phase used for any type of preparation that needs to be done before margin calculation and layout\n                     ,upMargins    ///< Phase in which the margins are calculated and set\n                     ,upLayout     ///< Final phase in which the layout system places the rects of the elements\n                   };\n  Q_ENUMS(UpdatePhase)\n\n  explicit QCPLayoutElement(QCustomPlot *parentPlot=0);\n  virtual ~QCPLayoutElement();\n  \n  // getters:\n  QCPLayout *layout() const { return mParentLayout; }\n  QRect rect() const { return mRect; }\n  QRect outerRect() const { return mOuterRect; }\n  QMargins margins() const { return mMargins; }\n  QMargins minimumMargins() const { return mMinimumMargins; }\n  QCP::MarginSides autoMargins() const { return mAutoMargins; }\n  QSize minimumSize() const { return mMinimumSize; }\n  QSize maximumSize() const { return mMaximumSize; }\n  QCPMarginGroup *marginGroup(QCP::MarginSide side) const { return mMarginGroups.value(side, (QCPMarginGroup*)0); }\n  QHash<QCP::MarginSide, QCPMarginGroup*> marginGroups() const { return mMarginGroups; }\n  \n  // setters:\n  void setOuterRect(const QRect &rect);\n  void setMargins(const QMargins &margins);\n  void setMinimumMargins(const QMargins &margins);\n  void setAutoMargins(QCP::MarginSides sides);\n  void setMinimumSize(const QSize &size);\n  void setMinimumSize(int width, int height);\n  void setMaximumSize(const QSize &size);\n  void setMaximumSize(int width, int height);\n  void setMarginGroup(QCP::MarginSides sides, QCPMarginGroup *group);\n  \n  // introduced virtual methods:\n  virtual void update(UpdatePhase phase);\n  virtual QSize minimumSizeHint() const;\n  virtual QSize maximumSizeHint() const;\n  virtual QList<QCPLayoutElement*> elements(bool recursive) const;\n  \n  // reimplemented virtual methods:\n  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;\n  \nprotected:\n  // property members:\n  QCPLayout *mParentLayout;\n  QSize mMinimumSize, mMaximumSize;\n  QRect mRect, mOuterRect;\n  QMargins mMargins, mMinimumMargins;\n  QCP::MarginSides mAutoMargins;\n  QHash<QCP::MarginSide, QCPMarginGroup*> mMarginGroups;\n  \n  // introduced virtual methods:\n  virtual int calculateAutoMargin(QCP::MarginSide side);\n  // events:\n  virtual void mousePressEvent(QMouseEvent *event) {Q_UNUSED(event)}\n  virtual void mouseMoveEvent(QMouseEvent *event) {Q_UNUSED(event)}\n  virtual void mouseReleaseEvent(QMouseEvent *event) {Q_UNUSED(event)}\n  virtual void mouseDoubleClickEvent(QMouseEvent *event) {Q_UNUSED(event)}\n  virtual void wheelEvent(QWheelEvent *event) {Q_UNUSED(event)}\n  \n  // reimplemented virtual methods:\n  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const { Q_UNUSED(painter) }\n  virtual void draw(QCPPainter *painter) { Q_UNUSED(painter) }\n  virtual void parentPlotInitialized(QCustomPlot *parentPlot);\n\nprivate:\n  Q_DISABLE_COPY(QCPLayoutElement)\n  \n  friend class QCustomPlot;\n  friend class QCPLayout;\n  friend class QCPMarginGroup;\n};\n\n\nclass QCP_LIB_DECL QCPLayout : public QCPLayoutElement\n{\n  Q_OBJECT\npublic:\n  explicit QCPLayout();\n  \n  // reimplemented virtual methods:\n  virtual void update(UpdatePhase phase);\n  virtual QList<QCPLayoutElement*> elements(bool recursive) const;\n  \n  // introduced virtual methods:\n  virtual int elementCount() const = 0;\n  virtual QCPLayoutElement* elementAt(int index) const = 0;\n  virtual QCPLayoutElement* takeAt(int index) = 0;\n  virtual bool take(QCPLayoutElement* element) = 0;\n  virtual void simplify();\n  \n  // non-virtual methods:\n  bool removeAt(int index);\n  bool remove(QCPLayoutElement* element);\n  void clear();\n  \nprotected:\n  // introduced virtual methods:\n  virtual void updateLayout();\n  \n  // non-virtual methods:\n  void sizeConstraintsChanged() const;\n  void adoptElement(QCPLayoutElement *el);\n  void releaseElement(QCPLayoutElement *el);\n  QVector<int> getSectionSizes(QVector<int> maxSizes, QVector<int> minSizes, QVector<double> stretchFactors, int totalSize) const;\n  \nprivate:\n  Q_DISABLE_COPY(QCPLayout)\n  friend class QCPLayoutElement;\n};\n\n\nclass QCP_LIB_DECL QCPLayoutGrid : public QCPLayout\n{\n  Q_OBJECT\n  /// \\cond INCLUDE_QPROPERTIES\n  Q_PROPERTY(int rowCount READ rowCount)\n  Q_PROPERTY(int columnCount READ columnCount)\n  Q_PROPERTY(QList<double> columnStretchFactors READ columnStretchFactors WRITE setColumnStretchFactors)\n  Q_PROPERTY(QList<double> rowStretchFactors READ rowStretchFactors WRITE setRowStretchFactors)\n  Q_PROPERTY(int columnSpacing READ columnSpacing WRITE setColumnSpacing)\n  Q_PROPERTY(int rowSpacing READ rowSpacing WRITE setRowSpacing)\n  /// \\endcond\npublic:\n  explicit QCPLayoutGrid();\n  virtual ~QCPLayoutGrid();\n  \n  // getters:\n  int rowCount() const;\n  int columnCount() const;\n  QList<double> columnStretchFactors() const { return mColumnStretchFactors; }\n  QList<double> rowStretchFactors() const { return mRowStretchFactors; }\n  int columnSpacing() const { return mColumnSpacing; }\n  int rowSpacing() const { return mRowSpacing; }\n  \n  // setters:\n  void setColumnStretchFactor(int column, double factor);\n  void setColumnStretchFactors(const QList<double> &factors);\n  void setRowStretchFactor(int row, double factor);\n  void setRowStretchFactors(const QList<double> &factors);\n  void setColumnSpacing(int pixels);\n  void setRowSpacing(int pixels);\n  \n  // reimplemented virtual methods:\n  virtual void updateLayout();\n  virtual int elementCount() const;\n  virtual QCPLayoutElement* elementAt(int index) const;\n  virtual QCPLayoutElement* takeAt(int index);\n  virtual bool take(QCPLayoutElement* element);\n  virtual QList<QCPLayoutElement*> elements(bool recursive) const;\n  virtual void simplify();\n  virtual QSize minimumSizeHint() const;\n  virtual QSize maximumSizeHint() const;\n  \n  // non-virtual methods:\n  QCPLayoutElement *element(int row, int column) const;\n  bool addElement(int row, int column, QCPLayoutElement *element);\n  bool hasElement(int row, int column);\n  void expandTo(int newRowCount, int newColumnCount);\n  void insertRow(int newIndex);\n  void insertColumn(int newIndex);\n  \nprotected:\n  // property members:\n  QList<QList<QCPLayoutElement*> > mElements;\n  QList<double> mColumnStretchFactors;\n  QList<double> mRowStretchFactors;\n  int mColumnSpacing, mRowSpacing;\n  \n  // non-virtual methods:\n  void getMinimumRowColSizes(QVector<int> *minColWidths, QVector<int> *minRowHeights) const;\n  void getMaximumRowColSizes(QVector<int> *maxColWidths, QVector<int> *maxRowHeights) const;\n  \nprivate:\n  Q_DISABLE_COPY(QCPLayoutGrid)\n};\n\n\nclass QCP_LIB_DECL QCPLayoutInset : public QCPLayout\n{\n  Q_OBJECT\npublic:\n  /*!\n    Defines how the placement and sizing is handled for a certain element in a QCPLayoutInset.\n  */\n  enum InsetPlacement { ipFree            ///< The element may be positioned/sized arbitrarily, see \\ref setInsetRect\n                        ,ipBorderAligned  ///< The element is aligned to one of the layout sides, see \\ref setInsetAlignment\n                      };\n  \n  explicit QCPLayoutInset();\n  virtual ~QCPLayoutInset();\n  \n  // getters:\n  InsetPlacement insetPlacement(int index) const;\n  Qt::Alignment insetAlignment(int index) const;\n  QRectF insetRect(int index) const;\n  \n  // setters:\n  void setInsetPlacement(int index, InsetPlacement placement);\n  void setInsetAlignment(int index, Qt::Alignment alignment);\n  void setInsetRect(int index, const QRectF &rect);\n  \n  // reimplemented virtual methods:\n  virtual void updateLayout();\n  virtual int elementCount() const;\n  virtual QCPLayoutElement* elementAt(int index) const;\n  virtual QCPLayoutElement* takeAt(int index);\n  virtual bool take(QCPLayoutElement* element);\n  virtual void simplify() {}\n  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;\n  \n  // non-virtual methods:\n  void addElement(QCPLayoutElement *element, Qt::Alignment alignment);\n  void addElement(QCPLayoutElement *element, const QRectF &rect);\n  \nprotected:\n  // property members:\n  QList<QCPLayoutElement*> mElements;\n  QList<InsetPlacement> mInsetPlacement;\n  QList<Qt::Alignment> mInsetAlignment;\n  QList<QRectF> mInsetRect;\n  \nprivate:\n  Q_DISABLE_COPY(QCPLayoutInset)\n};\n\n\nclass QCP_LIB_DECL QCPLineEnding\n{\n  Q_GADGET\npublic:\n  /*!\n    Defines the type of ending decoration for line-like items, e.g. an arrow.\n    \n    \\image html QCPLineEnding.png\n    \n    The width and length of these decorations can be controlled with the functions \\ref setWidth\n    and \\ref setLength. Some decorations like \\ref esDisc, \\ref esSquare, \\ref esDiamond and \\ref esBar only\n    support a width, the length property is ignored.\n    \n    \\see QCPItemLine::setHead, QCPItemLine::setTail, QCPItemCurve::setHead, QCPItemCurve::setTail, QCPAxis::setLowerEnding, QCPAxis::setUpperEnding\n  */\n  Q_ENUMS(EndingStyle)\n  enum EndingStyle { esNone          ///< No ending decoration\n                     ,esFlatArrow    ///< A filled arrow head with a straight/flat back (a triangle)\n                     ,esSpikeArrow   ///< A filled arrow head with an indented back\n                     ,esLineArrow    ///< A non-filled arrow head with open back\n                     ,esDisc         ///< A filled circle\n                     ,esSquare       ///< A filled square\n                     ,esDiamond      ///< A filled diamond (45° rotated square)\n                     ,esBar          ///< A bar perpendicular to the line\n                     ,esHalfBar      ///< A bar perpendicular to the line, pointing out to only one side (to which side can be changed with \\ref setInverted)\n                     ,esSkewedBar    ///< A bar that is skewed (skew controllable via \\ref setLength)\n                   };\n  \n  QCPLineEnding();\n  QCPLineEnding(EndingStyle style, double width=8, double length=10, bool inverted=false);\n  \n  // getters:\n  EndingStyle style() const { return mStyle; }\n  double width() const { return mWidth; }\n  double length() const { return mLength; }\n  bool inverted() const { return mInverted; }\n  \n  // setters:\n  void setStyle(EndingStyle style);\n  void setWidth(double width);\n  void setLength(double length);\n  void setInverted(bool inverted);\n  \n  // non-property methods:\n  double boundingDistance() const;\n  double realLength() const;\n  void draw(QCPPainter *painter, const QVector2D &pos, const QVector2D &dir) const;\n  void draw(QCPPainter *painter, const QVector2D &pos, double angle) const;\n  \nprotected:\n  // property members:\n  EndingStyle mStyle;\n  double mWidth, mLength;\n  bool mInverted;\n};\nQ_DECLARE_TYPEINFO(QCPLineEnding, Q_MOVABLE_TYPE);\n\n\nclass QCP_LIB_DECL QCPGrid :public QCPLayerable\n{\n  Q_OBJECT\n  /// \\cond INCLUDE_QPROPERTIES\n  Q_PROPERTY(bool subGridVisible READ subGridVisible WRITE setSubGridVisible)\n  Q_PROPERTY(bool antialiasedSubGrid READ antialiasedSubGrid WRITE setAntialiasedSubGrid)\n  Q_PROPERTY(bool antialiasedZeroLine READ antialiasedZeroLine WRITE setAntialiasedZeroLine)\n  Q_PROPERTY(QPen pen READ pen WRITE setPen)\n  Q_PROPERTY(QPen subGridPen READ subGridPen WRITE setSubGridPen)\n  Q_PROPERTY(QPen zeroLinePen READ zeroLinePen WRITE setZeroLinePen)\n  /// \\endcond\npublic:\n  QCPGrid(QCPAxis *parentAxis);\n  \n  // getters:\n  bool subGridVisible() const { return mSubGridVisible; }\n  bool antialiasedSubGrid() const { return mAntialiasedSubGrid; }\n  bool antialiasedZeroLine() const { return mAntialiasedZeroLine; }\n  QPen pen() const { return mPen; }\n  QPen subGridPen() const { return mSubGridPen; }\n  QPen zeroLinePen() const { return mZeroLinePen; }\n  \n  // setters:\n  void setSubGridVisible(bool visible);\n  void setAntialiasedSubGrid(bool enabled);\n  void setAntialiasedZeroLine(bool enabled);\n  void setPen(const QPen &pen);\n  void setSubGridPen(const QPen &pen);\n  void setZeroLinePen(const QPen &pen);\n  \nprotected:\n  // property members:\n  bool mSubGridVisible;\n  bool mAntialiasedSubGrid, mAntialiasedZeroLine;\n  QPen mPen, mSubGridPen, mZeroLinePen;\n  // non-property members:\n  QCPAxis *mParentAxis;\n  \n  // reimplemented virtual methods:\n  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;\n  virtual void draw(QCPPainter *painter);\n  \n  // non-virtual methods:\n  void drawGridLines(QCPPainter *painter) const;\n  void drawSubGridLines(QCPPainter *painter) const;\n  \n  friend class QCPAxis;\n};\n\n\nclass QCP_LIB_DECL QCPAxis : public QCPLayerable\n{\n  Q_OBJECT\n  /// \\cond INCLUDE_QPROPERTIES\n  Q_PROPERTY(AxisType axisType READ axisType)\n  Q_PROPERTY(QCPAxisRect* axisRect READ axisRect)\n  Q_PROPERTY(ScaleType scaleType READ scaleType WRITE setScaleType NOTIFY scaleTypeChanged)\n  Q_PROPERTY(double scaleLogBase READ scaleLogBase WRITE setScaleLogBase)\n  Q_PROPERTY(QCPRange range READ range WRITE setRange NOTIFY rangeChanged)\n  Q_PROPERTY(bool rangeReversed READ rangeReversed WRITE setRangeReversed)\n  Q_PROPERTY(bool autoTicks READ autoTicks WRITE setAutoTicks)\n  Q_PROPERTY(int autoTickCount READ autoTickCount WRITE setAutoTickCount)\n  Q_PROPERTY(bool autoTickLabels READ autoTickLabels WRITE setAutoTickLabels)\n  Q_PROPERTY(bool autoTickStep READ autoTickStep WRITE setAutoTickStep)\n  Q_PROPERTY(bool autoSubTicks READ autoSubTicks WRITE setAutoSubTicks)\n  Q_PROPERTY(bool ticks READ ticks WRITE setTicks)\n  Q_PROPERTY(bool tickLabels READ tickLabels WRITE setTickLabels)\n  Q_PROPERTY(int tickLabelPadding READ tickLabelPadding WRITE setTickLabelPadding)\n  Q_PROPERTY(LabelType tickLabelType READ tickLabelType WRITE setTickLabelType)\n  Q_PROPERTY(QFont tickLabelFont READ tickLabelFont WRITE setTickLabelFont)\n  Q_PROPERTY(QColor tickLabelColor READ tickLabelColor WRITE setTickLabelColor)\n  Q_PROPERTY(double tickLabelRotation READ tickLabelRotation WRITE setTickLabelRotation)\n  Q_PROPERTY(QString dateTimeFormat READ dateTimeFormat WRITE setDateTimeFormat)\n  Q_PROPERTY(Qt::TimeSpec dateTimeSpec READ dateTimeSpec WRITE setDateTimeSpec)\n  Q_PROPERTY(QString numberFormat READ numberFormat WRITE setNumberFormat)\n  Q_PROPERTY(int numberPrecision READ numberPrecision WRITE setNumberPrecision)\n  Q_PROPERTY(double tickStep READ tickStep WRITE setTickStep)\n  Q_PROPERTY(QVector<double> tickVector READ tickVector WRITE setTickVector)\n  Q_PROPERTY(QVector<QString> tickVectorLabels READ tickVectorLabels WRITE setTickVectorLabels)\n  Q_PROPERTY(int tickLengthIn READ tickLengthIn WRITE setTickLengthIn)\n  Q_PROPERTY(int tickLengthOut READ tickLengthOut WRITE setTickLengthOut)\n  Q_PROPERTY(int subTickCount READ subTickCount WRITE setSubTickCount)\n  Q_PROPERTY(int subTickLengthIn READ subTickLengthIn WRITE setSubTickLengthIn)\n  Q_PROPERTY(int subTickLengthOut READ subTickLengthOut WRITE setSubTickLengthOut)\n  Q_PROPERTY(QPen basePen READ basePen WRITE setBasePen)\n  Q_PROPERTY(QPen tickPen READ tickPen WRITE setTickPen)\n  Q_PROPERTY(QPen subTickPen READ subTickPen WRITE setSubTickPen)\n  Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont)\n  Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor)\n  Q_PROPERTY(QString label READ label WRITE setLabel)\n  Q_PROPERTY(int labelPadding READ labelPadding WRITE setLabelPadding)\n  Q_PROPERTY(int padding READ padding WRITE setPadding)\n  Q_PROPERTY(int offset READ offset WRITE setOffset)\n  Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE setSelectedParts NOTIFY selectionChanged)\n  Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE setSelectableParts NOTIFY selectableChanged)\n  Q_PROPERTY(QFont selectedTickLabelFont READ selectedTickLabelFont WRITE setSelectedTickLabelFont)\n  Q_PROPERTY(QFont selectedLabelFont READ selectedLabelFont WRITE setSelectedLabelFont)\n  Q_PROPERTY(QColor selectedTickLabelColor READ selectedTickLabelColor WRITE setSelectedTickLabelColor)\n  Q_PROPERTY(QColor selectedLabelColor READ selectedLabelColor WRITE setSelectedLabelColor)\n  Q_PROPERTY(QPen selectedBasePen READ selectedBasePen WRITE setSelectedBasePen)\n  Q_PROPERTY(QPen selectedTickPen READ selectedTickPen WRITE setSelectedTickPen)\n  Q_PROPERTY(QPen selectedSubTickPen READ selectedSubTickPen WRITE setSelectedSubTickPen)\n  Q_PROPERTY(QCPLineEnding lowerEnding READ lowerEnding WRITE setLowerEnding)\n  Q_PROPERTY(QCPLineEnding upperEnding READ upperEnding WRITE setUpperEnding)\n  Q_PROPERTY(QCPGrid* grid READ grid)\n  /// \\endcond\npublic:\n  /*!\n    Defines at which side of the axis rect the axis will appear. This also affects how the tick\n    marks are drawn, on which side the labels are placed etc.\n  */\n  enum AxisType { atLeft    = 0x01  ///< <tt>0x01</tt> Axis is vertical and on the left side of the axis rect\n                  ,atRight  = 0x02  ///< <tt>0x02</tt> Axis is vertical and on the right side of the axis rect\n                  ,atTop    = 0x04  ///< <tt>0x04</tt> Axis is horizontal and on the top side of the axis rect\n                  ,atBottom = 0x08  ///< <tt>0x08</tt> Axis is horizontal and on the bottom side of the axis rect\n                };\n  Q_FLAGS(AxisType AxisTypes)\n  Q_DECLARE_FLAGS(AxisTypes, AxisType)\n  /*!\n    When automatic tick label generation is enabled (\\ref setAutoTickLabels), defines how the\n    coordinate of the tick is interpreted, i.e. translated into a string.\n    \n    \\see setTickLabelType\n  */\n  enum LabelType { ltNumber    ///< Tick coordinate is regarded as normal number and will be displayed as such. (see \\ref setNumberFormat)\n                   ,ltDateTime ///< Tick coordinate is regarded as a date/time (seconds since 1970-01-01T00:00:00 UTC) and will be displayed and formatted as such. (for details, see \\ref setDateTimeFormat)\n                 };\n  Q_ENUMS(LabelType)\n  /*!\n    Defines the scale of an axis.\n    \\see setScaleType\n  */\n  enum ScaleType { stLinear       ///< Linear scaling\n                   ,stLogarithmic ///< Logarithmic scaling with correspondingly transformed plots and (major) tick marks at every base power (see \\ref setScaleLogBase).\n                 };\n  Q_ENUMS(ScaleType)\n  /*!\n    Defines the selectable parts of an axis.\n    \\see setSelectableParts, setSelectedParts\n  */\n  enum SelectablePart { spNone        = 0      ///< None of the selectable parts\n                        ,spAxis       = 0x001  ///< The axis backbone and tick marks\n                        ,spTickLabels = 0x002  ///< Tick labels (numbers) of this axis (as a whole, not individually)\n                        ,spAxisLabel  = 0x004  ///< The axis label\n                      };\n  Q_FLAGS(SelectablePart SelectableParts)\n  Q_DECLARE_FLAGS(SelectableParts, SelectablePart)\n  \n  explicit QCPAxis(QCPAxisRect *parent, AxisType type);\n  virtual ~QCPAxis();\n  \n  // getters:\n  AxisType axisType() const { return mAxisType; }\n  QCPAxisRect *axisRect() const { return mAxisRect; }\n  ScaleType scaleType() const { return mScaleType; }\n  double scaleLogBase() const { return mScaleLogBase; }\n  const QCPRange range() const { return mRange; }\n  bool rangeReversed() const { return mRangeReversed; }\n  bool autoTicks() const { return mAutoTicks; }\n  int autoTickCount() const { return mAutoTickCount; }\n  bool autoTickLabels() const { return mAutoTickLabels; }\n  bool autoTickStep() const { return mAutoTickStep; }\n  bool autoSubTicks() const { return mAutoSubTicks; }\n  bool ticks() const { return mTicks; }\n  bool tickLabels() const { return mTickLabels; }\n  int tickLabelPadding() const;\n  LabelType tickLabelType() const { return mTickLabelType; }\n  QFont tickLabelFont() const { return mTickLabelFont; }\n  QColor tickLabelColor() const { return mTickLabelColor; }\n  double tickLabelRotation() const;\n  QString dateTimeFormat() const { return mDateTimeFormat; }\n  Qt::TimeSpec dateTimeSpec() const { return mDateTimeSpec; }\n  QString numberFormat() const;\n  int numberPrecision() const { return mNumberPrecision; }\n  double tickStep() const { return mTickStep; }\n  QVector<double> tickVector() const { return mTickVector; }\n  QVector<QString> tickVectorLabels() const { return mTickVectorLabels; }\n  int tickLengthIn() const;\n  int tickLengthOut() const;\n  int subTickCount() const { return mSubTickCount; }\n  int subTickLengthIn() const;\n  int subTickLengthOut() const;\n  QPen basePen() const { return mBasePen; }\n  QPen tickPen() const { return mTickPen; }\n  QPen subTickPen() const { return mSubTickPen; }\n  QFont labelFont() const { return mLabelFont; }\n  QColor labelColor() const { return mLabelColor; }\n  QString label() const { return mLabel; }\n  int labelPadding() const;\n  int padding() const { return mPadding; }\n  int offset() const;\n  SelectableParts selectedParts() const { return mSelectedParts; }\n  SelectableParts selectableParts() const { return mSelectableParts; }\n  QFont selectedTickLabelFont() const { return mSelectedTickLabelFont; }\n  QFont selectedLabelFont() const { return mSelectedLabelFont; }\n  QColor selectedTickLabelColor() const { return mSelectedTickLabelColor; }\n  QColor selectedLabelColor() const { return mSelectedLabelColor; }\n  QPen selectedBasePen() const { return mSelectedBasePen; }\n  QPen selectedTickPen() const { return mSelectedTickPen; }\n  QPen selectedSubTickPen() const { return mSelectedSubTickPen; }\n  QCPLineEnding lowerEnding() const;\n  QCPLineEnding upperEnding() const;\n  QCPGrid *grid() const { return mGrid; }\n  \n  // setters:\n  Q_SLOT void setScaleType(QCPAxis::ScaleType type);\n  void setScaleLogBase(double base);\n  Q_SLOT void setRange(const QCPRange &range);\n  void setRange(double lower, double upper);\n  void setRange(double position, double size, Qt::AlignmentFlag alignment);\n  void setRangeLower(double lower);\n  void setRangeUpper(double upper);\n  void setRangeReversed(bool reversed);\n  void setAutoTicks(bool on);\n  void setAutoTickCount(int approximateCount);\n  void setAutoTickLabels(bool on);\n  void setAutoTickStep(bool on);\n  void setAutoSubTicks(bool on);\n  void setTicks(bool show);\n  void setTickLabels(bool show);\n  void setTickLabelPadding(int padding);\n  void setTickLabelType(LabelType type);\n  void setTickLabelFont(const QFont &font);\n  void setTickLabelColor(const QColor &color);\n  void setTickLabelRotation(double degrees);\n  void setDateTimeFormat(const QString &format);\n  void setDateTimeSpec(const Qt::TimeSpec &timeSpec);\n  void setNumberFormat(const QString &formatCode);\n  void setNumberPrecision(int precision);\n  void setTickStep(double step);\n  void setTickVector(const QVector<double> &vec);\n  void setTickVectorLabels(const QVector<QString> &vec);\n  void setTickLength(int inside, int outside=0);\n  void setTickLengthIn(int inside);\n  void setTickLengthOut(int outside);\n  void setSubTickCount(int count);\n  void setSubTickLength(int inside, int outside=0);\n  void setSubTickLengthIn(int inside);\n  void setSubTickLengthOut(int outside);\n  void setBasePen(const QPen &pen);\n  void setTickPen(const QPen &pen);\n  void setSubTickPen(const QPen &pen);\n  void setLabelFont(const QFont &font);\n  void setLabelColor(const QColor &color);\n  void setLabel(const QString &str);\n  void setLabelPadding(int padding);\n  void setPadding(int padding);\n  void setOffset(int offset);\n  void setSelectedTickLabelFont(const QFont &font);\n  void setSelectedLabelFont(const QFont &font);\n  void setSelectedTickLabelColor(const QColor &color);\n  void setSelectedLabelColor(const QColor &color);\n  void setSelectedBasePen(const QPen &pen);\n  void setSelectedTickPen(const QPen &pen);\n  void setSelectedSubTickPen(const QPen &pen);\n  Q_SLOT void setSelectableParts(const QCPAxis::SelectableParts &selectableParts);\n  Q_SLOT void setSelectedParts(const QCPAxis::SelectableParts &selectedParts);\n  void setLowerEnding(const QCPLineEnding &ending);\n  void setUpperEnding(const QCPLineEnding &ending);\n  \n  // reimplemented virtual methods:\n  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;\n  \n  // non-property methods:\n  Qt::Orientation orientation() const { return mOrientation; }\n  void moveRange(double diff);\n  void scaleRange(double factor, double center);\n  void setScaleRatio(const QCPAxis *otherAxis, double ratio=1.0);\n  void rescale(bool onlyVisiblePlottables=false);\n  double pixelToCoord(double value) const;\n  double coordToPixel(double value) const;\n  SelectablePart getPartAt(const QPointF &pos) const;\n  QList<QCPAbstractPlottable*> plottables() const;\n  QList<QCPGraph*> graphs() const;\n  QList<QCPAbstractItem*> items() const;\n  \n  static AxisType marginSideToAxisType(QCP::MarginSide side);\n  static Qt::Orientation orientation(AxisType type) { return type==atBottom||type==atTop ? Qt::Horizontal : Qt::Vertical; }\n  static AxisType opposite(AxisType type);\n  \nsignals:\n  void ticksRequest();\n  void rangeChanged(const QCPRange &newRange);\n  void rangeChanged(const QCPRange &newRange, const QCPRange &oldRange);\n  void scaleTypeChanged(QCPAxis::ScaleType scaleType);\n  void selectionChanged(const QCPAxis::SelectableParts &parts);\n  void selectableChanged(const QCPAxis::SelectableParts &parts);\n\nprotected:\n  // property members:\n  // axis base:\n  AxisType mAxisType;\n  QCPAxisRect *mAxisRect;\n  //int mOffset; // in QCPAxisPainter\n  int mPadding;\n  Qt::Orientation mOrientation;\n  SelectableParts mSelectableParts, mSelectedParts;\n  QPen mBasePen, mSelectedBasePen;\n  //QCPLineEnding mLowerEnding, mUpperEnding; // in QCPAxisPainter\n  // axis label:\n  //int mLabelPadding; // in QCPAxisPainter\n  QString mLabel;\n  QFont mLabelFont, mSelectedLabelFont;\n  QColor mLabelColor, mSelectedLabelColor;\n  // tick labels:\n  //int mTickLabelPadding; // in QCPAxisPainter\n  bool mTickLabels, mAutoTickLabels;\n  //double mTickLabelRotation; // in QCPAxisPainter\n  LabelType mTickLabelType;\n  QFont mTickLabelFont, mSelectedTickLabelFont;\n  QColor mTickLabelColor, mSelectedTickLabelColor;\n  QString mDateTimeFormat;\n  Qt::TimeSpec mDateTimeSpec;\n  int mNumberPrecision;\n  char mNumberFormatChar;\n  bool mNumberBeautifulPowers;\n  //bool mNumberMultiplyCross; // QCPAxisPainter\n  // ticks and subticks:\n  bool mTicks;\n  double mTickStep;\n  int mSubTickCount, mAutoTickCount;\n  bool mAutoTicks, mAutoTickStep, mAutoSubTicks;\n  //int mTickLengthIn, mTickLengthOut, mSubTickLengthIn, mSubTickLengthOut; // QCPAxisPainter\n  QPen mTickPen, mSelectedTickPen;\n  QPen mSubTickPen, mSelectedSubTickPen;\n  // scale and range:\n  QCPRange mRange;\n  bool mRangeReversed;\n  ScaleType mScaleType;\n  double mScaleLogBase, mScaleLogBaseLogInv;\n  \n  // non-property members:\n  QCPGrid *mGrid;\n  QCPAxisPainterPrivate *mAxisPainter;\n  int mLowestVisibleTick, mHighestVisibleTick;\n  QVector<double> mTickVector;\n  QVector<QString> mTickVectorLabels;\n  QVector<double> mSubTickVector;\n  bool mCachedMarginValid;\n  int mCachedMargin;\n  \n  // introduced virtual methods:\n  virtual void setupTickVectors();\n  virtual void generateAutoTicks();\n  virtual int calculateAutoSubTickCount(double tickStep) const;\n  virtual int calculateMargin();\n  \n  // reimplemented virtual methods:\n  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;\n  virtual void draw(QCPPainter *painter);\n  virtual QCP::Interaction selectionCategory() const;\n  // events:\n  virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);\n  virtual void deselectEvent(bool *selectionStateChanged);\n  \n  // non-virtual methods:\n  void visibleTickBounds(int &lowIndex, int &highIndex) const;\n  double baseLog(double value) const;\n  double basePow(double value) const;\n  QPen getBasePen() const;\n  QPen getTickPen() const;\n  QPen getSubTickPen() const;\n  QFont getTickLabelFont() const;\n  QFont getLabelFont() const;\n  QColor getTickLabelColor() const;\n  QColor getLabelColor() const;\n  \nprivate:\n  Q_DISABLE_COPY(QCPAxis)\n  \n  friend class QCustomPlot;\n  friend class QCPGrid;\n  friend class QCPAxisRect;\n};\nQ_DECLARE_OPERATORS_FOR_FLAGS(QCPAxis::SelectableParts)\nQ_DECLARE_OPERATORS_FOR_FLAGS(QCPAxis::AxisTypes)\nQ_DECLARE_METATYPE(QCPAxis::SelectablePart)\n\n\nclass QCPAxisPainterPrivate\n{\npublic:\n  explicit QCPAxisPainterPrivate(QCustomPlot *parentPlot);\n  virtual ~QCPAxisPainterPrivate();\n  \n  virtual void draw(QCPPainter *painter);\n  virtual int size() const;\n  void clearCache();\n  \n  QRect axisSelectionBox() const { return mAxisSelectionBox; }\n  QRect tickLabelsSelectionBox() const { return mTickLabelsSelectionBox; }\n  QRect labelSelectionBox() const { return mLabelSelectionBox; }\n  \n  // public property members:\n  QCPAxis::AxisType type;\n  QPen basePen;\n  QCPLineEnding lowerEnding, upperEnding; // directly accessed by QCPAxis setters/getters\n  int labelPadding; // directly accessed by QCPAxis setters/getters\n  QFont labelFont;\n  QColor labelColor;\n  QString label;\n  int tickLabelPadding; // directly accessed by QCPAxis setters/getters\n  double tickLabelRotation; // directly accessed by QCPAxis setters/getters\n  bool substituteExponent;\n  bool numberMultiplyCross; // directly accessed by QCPAxis setters/getters\n  int tickLengthIn, tickLengthOut, subTickLengthIn, subTickLengthOut; // directly accessed by QCPAxis setters/getters\n  QPen tickPen, subTickPen;\n  QFont tickLabelFont;\n  QColor tickLabelColor;\n  QRect alignmentRect, viewportRect;\n  double offset; // directly accessed by QCPAxis setters/getters\n  bool abbreviateDecimalPowers;\n  bool reversedEndings;\n  \n  QVector<double> subTickPositions;\n  QVector<double> tickPositions;\n  QVector<QString> tickLabels;\n  \nprotected:\n  struct CachedLabel\n  {\n    QPointF offset;\n    QPixmap pixmap;\n  };\n  struct TickLabelData\n  {\n    QString basePart, expPart;\n    QRect baseBounds, expBounds, totalBounds, rotatedTotalBounds;\n    QFont baseFont, expFont;\n  };\n  QCustomPlot *mParentPlot;\n  QByteArray mLabelParameterHash; // to determine whether mLabelCache needs to be cleared due to changed parameters\n  QCache<QString, CachedLabel> mLabelCache;\n  QRect mAxisSelectionBox, mTickLabelsSelectionBox, mLabelSelectionBox;\n  \n  virtual QByteArray generateLabelParameterHash() const;\n  \n  virtual void placeTickLabel(QCPPainter *painter, double position, int distanceToAxis, const QString &text, QSize *tickLabelsSize);\n  virtual void drawTickLabel(QCPPainter *painter, double x, double y, const TickLabelData &labelData) const;\n  virtual TickLabelData getTickLabelData(const QFont &font, const QString &text) const;\n  virtual QPointF getTickLabelDrawOffset(const TickLabelData &labelData) const;\n  virtual void getMaxTickLabelSize(const QFont &font, const QString &text, QSize *tickLabelsSize) const;\n};\n\n\nclass QCP_LIB_DECL QCPAbstractPlottable : public QCPLayerable\n{\n  Q_OBJECT\n  /// \\cond INCLUDE_QPROPERTIES\n  Q_PROPERTY(QString name READ name WRITE setName)\n  Q_PROPERTY(bool antialiasedFill READ antialiasedFill WRITE setAntialiasedFill)\n  Q_PROPERTY(bool antialiasedScatters READ antialiasedScatters WRITE setAntialiasedScatters)\n  Q_PROPERTY(bool antialiasedErrorBars READ antialiasedErrorBars WRITE setAntialiasedErrorBars)\n  Q_PROPERTY(QPen pen READ pen WRITE setPen)\n  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)\n  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)\n  Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)\n  Q_PROPERTY(QCPAxis* keyAxis READ keyAxis WRITE setKeyAxis)\n  Q_PROPERTY(QCPAxis* valueAxis READ valueAxis WRITE setValueAxis)\n  Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged)\n  Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectionChanged)\n  /// \\endcond\npublic:\n  QCPAbstractPlottable(QCPAxis *keyAxis, QCPAxis *valueAxis);\n  \n  // getters:\n  QString name() const { return mName; }\n  bool antialiasedFill() const { return mAntialiasedFill; }\n  bool antialiasedScatters() const { return mAntialiasedScatters; }\n  bool antialiasedErrorBars() const { return mAntialiasedErrorBars; }\n  QPen pen() const { return mPen; }\n  QPen selectedPen() const { return mSelectedPen; }\n  QBrush brush() const { return mBrush; }\n  QBrush selectedBrush() const { return mSelectedBrush; }\n  QCPAxis *keyAxis() const { return mKeyAxis.data(); }\n  QCPAxis *valueAxis() const { return mValueAxis.data(); }\n  bool selectable() const { return mSelectable; }\n  bool selected() const { return mSelected; }\n  \n  // setters:\n  void setName(const QString &name);\n  void setAntialiasedFill(bool enabled);\n  void setAntialiasedScatters(bool enabled);\n  void setAntialiasedErrorBars(bool enabled);\n  void setPen(const QPen &pen);\n  void setSelectedPen(const QPen &pen);\n  void setBrush(const QBrush &brush);\n  void setSelectedBrush(const QBrush &brush);\n  void setKeyAxis(QCPAxis *axis);\n  void setValueAxis(QCPAxis *axis);\n  Q_SLOT void setSelectable(bool selectable);\n  Q_SLOT void setSelected(bool selected);\n\n  // introduced virtual methods:\n  virtual void clearData() = 0;\n  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const = 0;\n  virtual bool addToLegend();\n  virtual bool removeFromLegend() const;\n  \n  // non-property methods:\n  void rescaleAxes(bool onlyEnlarge=false) const;\n  void rescaleKeyAxis(bool onlyEnlarge=false) const;\n  void rescaleValueAxis(bool onlyEnlarge=false) const;\n  \nsignals:\n  void selectionChanged(bool selected);\n  void selectableChanged(bool selectable);\n  \nprotected:\n  /*!\n    Represents negative and positive sign domain for passing to \\ref getKeyRange and \\ref getValueRange.\n  */\n  enum SignDomain { sdNegative  ///< The negative sign domain, i.e. numbers smaller than zero\n                    ,sdBoth     ///< Both sign domains, including zero, i.e. all (rational) numbers\n                    ,sdPositive ///< The positive sign domain, i.e. numbers greater than zero\n                  };\n  \n  // property members:\n  QString mName;\n  bool mAntialiasedFill, mAntialiasedScatters, mAntialiasedErrorBars;\n  QPen mPen, mSelectedPen;\n  QBrush mBrush, mSelectedBrush;\n  QPointer<QCPAxis> mKeyAxis, mValueAxis;\n  bool mSelectable, mSelected;\n  \n  // reimplemented virtual methods:\n  virtual QRect clipRect() const;\n  virtual void draw(QCPPainter *painter) = 0;\n  virtual QCP::Interaction selectionCategory() const;\n  void applyDefaultAntialiasingHint(QCPPainter *painter) const;\n  // events:\n  virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);\n  virtual void deselectEvent(bool *selectionStateChanged);\n  \n  // introduced virtual methods:\n  virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const = 0;\n  virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const = 0;\n  virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const = 0;\n  \n  // non-virtual methods:\n  void coordsToPixels(double key, double value, double &x, double &y) const;\n  const QPointF coordsToPixels(double key, double value) const;\n  void pixelsToCoords(double x, double y, double &key, double &value) const;\n  void pixelsToCoords(const QPointF &pixelPos, double &key, double &value) const;\n  QPen mainPen() const;\n  QBrush mainBrush() const;\n  void applyFillAntialiasingHint(QCPPainter *painter) const;\n  void applyScattersAntialiasingHint(QCPPainter *painter) const;\n  void applyErrorBarsAntialiasingHint(QCPPainter *painter) const;\n  double distSqrToLine(const QPointF &start, const QPointF &end, const QPointF &point) const;\n\nprivate:\n  Q_DISABLE_COPY(QCPAbstractPlottable)\n  \n  friend class QCustomPlot;\n  friend class QCPAxis;\n  friend class QCPPlottableLegendItem;\n};\n\n\nclass QCP_LIB_DECL QCPItemAnchor\n{\npublic:\n  QCPItemAnchor(QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString name, int anchorId=-1);\n  virtual ~QCPItemAnchor();\n  \n  // getters:\n  QString name() const { return mName; }\n  virtual QPointF pixelPoint() const;\n  \nprotected:\n  // property members:\n  QString mName;\n  \n  // non-property members:\n  QCustomPlot *mParentPlot;\n  QCPAbstractItem *mParentItem;\n  int mAnchorId;\n  QSet<QCPItemPosition*> mChildren;\n  \n  // introduced virtual methods:\n  virtual QCPItemPosition *toQCPItemPosition() { return 0; }\n  \n  // non-virtual methods:\n  void addChild(QCPItemPosition* pos); // called from pos when this anchor is set as parent\n  void removeChild(QCPItemPosition *pos); // called from pos when its parent anchor is reset or pos deleted\n  \nprivate:\n  Q_DISABLE_COPY(QCPItemAnchor)\n  \n  friend class QCPItemPosition;\n};\n\n\n\nclass QCP_LIB_DECL QCPItemPosition : public QCPItemAnchor\n{\npublic:\n  /*!\n    Defines the ways an item position can be specified. Thus it defines what the numbers passed to\n    \\ref setCoords actually mean.\n    \n    \\see setType\n  */\n  enum PositionType { ptAbsolute        ///< Static positioning in pixels, starting from the top left corner of the viewport/widget.\n                      ,ptViewportRatio  ///< Static positioning given by a fraction of the viewport size. For example, if you call setCoords(0, 0), the position will be at the top\n                                        ///< left corner of the viewport/widget. setCoords(1, 1) will be at the bottom right corner, setCoords(0.5, 0) will be horizontally centered and\n                                        ///< vertically at the top of the viewport/widget, etc.\n                      ,ptAxisRectRatio  ///< Static positioning given by a fraction of the axis rect size (see \\ref setAxisRect). For example, if you call setCoords(0, 0), the position will be at the top\n                                        ///< left corner of the axis rect. setCoords(1, 1) will be at the bottom right corner, setCoords(0.5, 0) will be horizontally centered and\n                                        ///< vertically at the top of the axis rect, etc. You can also go beyond the axis rect by providing negative coordinates or coordinates larger than 1.\n                      ,ptPlotCoords     ///< Dynamic positioning at a plot coordinate defined by two axes (see \\ref setAxes).\n                    };\n  \n  QCPItemPosition(QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString name);\n  virtual ~QCPItemPosition();\n  \n  // getters:\n  PositionType type() const { return mPositionType; }\n  QCPItemAnchor *parentAnchor() const { return mParentAnchor; }\n  double key() const { return mKey; }\n  double value() const { return mValue; }\n  QPointF coords() const { return QPointF(mKey, mValue); }\n  QCPAxis *keyAxis() const { return mKeyAxis.data(); }\n  QCPAxis *valueAxis() const { return mValueAxis.data(); }\n  QCPAxisRect *axisRect() const;\n  virtual QPointF pixelPoint() const;\n  \n  // setters:\n  void setType(PositionType type);\n  bool setParentAnchor(QCPItemAnchor *parentAnchor, bool keepPixelPosition=false);\n  void setCoords(double key, double value);\n  void setCoords(const QPointF &coords);\n  void setAxes(QCPAxis* keyAxis, QCPAxis* valueAxis);\n  void setAxisRect(QCPAxisRect *axisRect);\n  void setPixelPoint(const QPointF &pixelPoint);\n  \nprotected:\n  // property members:\n  PositionType mPositionType;\n  QPointer<QCPAxis> mKeyAxis, mValueAxis;\n  QPointer<QCPAxisRect> mAxisRect;\n  double mKey, mValue;\n  QCPItemAnchor *mParentAnchor;\n  \n  // reimplemented virtual methods:\n  virtual QCPItemPosition *toQCPItemPosition() { return this; }\n  \nprivate:\n  Q_DISABLE_COPY(QCPItemPosition)\n  \n};\n\n\nclass QCP_LIB_DECL QCPAbstractItem : public QCPLayerable\n{\n  Q_OBJECT\n  /// \\cond INCLUDE_QPROPERTIES\n  Q_PROPERTY(bool clipToAxisRect READ clipToAxisRect WRITE setClipToAxisRect)\n  Q_PROPERTY(QCPAxisRect* clipAxisRect READ clipAxisRect WRITE setClipAxisRect)\n  Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged)\n  Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectionChanged)\n  /// \\endcond\npublic:\n  QCPAbstractItem(QCustomPlot *parentPlot);\n  virtual ~QCPAbstractItem();\n  \n  // getters:\n  bool clipToAxisRect() const { return mClipToAxisRect; }\n  QCPAxisRect *clipAxisRect() const;\n  bool selectable() const { return mSelectable; }\n  bool selected() const { return mSelected; }\n  \n  // setters:\n  void setClipToAxisRect(bool clip);\n  void setClipAxisRect(QCPAxisRect *rect);\n  Q_SLOT void setSelectable(bool selectable);\n  Q_SLOT void setSelected(bool selected);\n  \n  // reimplemented virtual methods:\n  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const = 0;\n  \n  // non-virtual methods:\n  QList<QCPItemPosition*> positions() const { return mPositions; }\n  QList<QCPItemAnchor*> anchors() const { return mAnchors; }\n  QCPItemPosition *position(const QString &name) const;\n  QCPItemAnchor *anchor(const QString &name) const;\n  bool hasAnchor(const QString &name) const;\n  \nsignals:\n  void selectionChanged(bool selected);\n  void selectableChanged(bool selectable);\n  \nprotected:\n  // property members:\n  bool mClipToAxisRect;\n  QPointer<QCPAxisRect> mClipAxisRect;\n  QList<QCPItemPosition*> mPositions;\n  QList<QCPItemAnchor*> mAnchors;\n  bool mSelectable, mSelected;\n  \n  // reimplemented virtual methods:\n  virtual QCP::Interaction selectionCategory() const;\n  virtual QRect clipRect() const;\n  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;\n  virtual void draw(QCPPainter *painter) = 0;\n  // events:\n  virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);\n  virtual void deselectEvent(bool *selectionStateChanged);\n  \n  // introduced virtual methods:\n  virtual QPointF anchorPixelPoint(int anchorId) const;\n  \n  // non-virtual methods:\n  double distSqrToLine(const QPointF &start, const QPointF &end, const QPointF &point) const;\n  double rectSelectTest(const QRectF &rect, const QPointF &pos, bool filledRect) const;\n  QCPItemPosition *createPosition(const QString &name);\n  QCPItemAnchor *createAnchor(const QString &name, int anchorId);\n  \nprivate:\n  Q_DISABLE_COPY(QCPAbstractItem)\n  \n  friend class QCustomPlot;\n  friend class QCPItemAnchor;\n};\n\n\nclass QCP_LIB_DECL QCustomPlot : public QWidget\n{\n  Q_OBJECT\n  /// \\cond INCLUDE_QPROPERTIES\n  Q_PROPERTY(QRect viewport READ viewport WRITE setViewport)\n  Q_PROPERTY(QPixmap background READ background WRITE setBackground)\n  Q_PROPERTY(bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled)\n  Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode)\n  Q_PROPERTY(QCPLayoutGrid* plotLayout READ plotLayout)\n  Q_PROPERTY(bool autoAddPlottableToLegend READ autoAddPlottableToLegend WRITE setAutoAddPlottableToLegend)\n  Q_PROPERTY(int selectionTolerance READ selectionTolerance WRITE setSelectionTolerance)\n  Q_PROPERTY(bool noAntialiasingOnDrag READ noAntialiasingOnDrag WRITE setNoAntialiasingOnDrag)\n  Q_PROPERTY(Qt::KeyboardModifier multiSelectModifier READ multiSelectModifier WRITE setMultiSelectModifier)\n  /// \\endcond\npublic:\n  /*!\n    Defines how a layer should be inserted relative to an other layer.\n\n    \\see addLayer, moveLayer\n  */\n  enum LayerInsertMode { limBelow  ///< Layer is inserted below other layer\n                         ,limAbove ///< Layer is inserted above other layer\n                       };\n  Q_ENUMS(LayerInsertMode)\n  \n  /*!\n    Defines with what timing the QCustomPlot surface is refreshed after a replot.\n\n    \\see replot\n  */\n  enum RefreshPriority { rpImmediate ///< The QCustomPlot surface is immediately refreshed, by calling QWidget::repaint() after the replot\n                         ,rpQueued   ///< Queues the refresh such that it is performed at a slightly delayed point in time after the replot, by calling QWidget::update() after the replot\n                         ,rpHint     ///< Whether to use immediate repaint or queued update depends on whether the plotting hint \\ref QCP::phForceRepaint is set, see \\ref setPlottingHints.\n                       };\n  \n  explicit QCustomPlot(QWidget *parent = 0);\n  virtual ~QCustomPlot();\n  \n  // getters:\n  QRect viewport() const { return mViewport; }\n  QPixmap background() const { return mBackgroundPixmap; }\n  bool backgroundScaled() const { return mBackgroundScaled; }\n  Qt::AspectRatioMode backgroundScaledMode() const { return mBackgroundScaledMode; }\n  QCPLayoutGrid *plotLayout() const { return mPlotLayout; }\n  QCP::AntialiasedElements antialiasedElements() const { return mAntialiasedElements; }\n  QCP::AntialiasedElements notAntialiasedElements() const { return mNotAntialiasedElements; }\n  bool autoAddPlottableToLegend() const { return mAutoAddPlottableToLegend; }\n  const QCP::Interactions interactions() const { return mInteractions; }\n  int selectionTolerance() const { return mSelectionTolerance; }\n  bool noAntialiasingOnDrag() const { return mNoAntialiasingOnDrag; }\n  QCP::PlottingHints plottingHints() const { return mPlottingHints; }\n  Qt::KeyboardModifier multiSelectModifier() const { return mMultiSelectModifier; }\n\n  // setters:\n  void setViewport(const QRect &rect);\n  void setBackground(const QPixmap &pm);\n  void setBackground(const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding);\n  void setBackground(const QBrush &brush);\n  void setBackgroundScaled(bool scaled);\n  void setBackgroundScaledMode(Qt::AspectRatioMode mode);\n  void setAntialiasedElements(const QCP::AntialiasedElements &antialiasedElements);\n  void setAntialiasedElement(QCP::AntialiasedElement antialiasedElement, bool enabled=true);\n  void setNotAntialiasedElements(const QCP::AntialiasedElements &notAntialiasedElements);\n  void setNotAntialiasedElement(QCP::AntialiasedElement notAntialiasedElement, bool enabled=true);\n  void setAutoAddPlottableToLegend(bool on);\n  void setInteractions(const QCP::Interactions &interactions);\n  void setInteraction(const QCP::Interaction &interaction, bool enabled=true);\n  void setSelectionTolerance(int pixels);\n  void setNoAntialiasingOnDrag(bool enabled);\n  void setPlottingHints(const QCP::PlottingHints &hints);\n  void setPlottingHint(QCP::PlottingHint hint, bool enabled=true);\n  void setMultiSelectModifier(Qt::KeyboardModifier modifier);\n  \n  // non-property methods:\n  // plottable interface:\n  QCPAbstractPlottable *plottable(int index);\n  QCPAbstractPlottable *plottable();\n  bool addPlottable(QCPAbstractPlottable *plottable);\n  bool removePlottable(QCPAbstractPlottable *plottable);\n  bool removePlottable(int index);\n  int clearPlottables();\n  int plottableCount() const;\n  QList<QCPAbstractPlottable*> selectedPlottables() const;\n  QCPAbstractPlottable *plottableAt(const QPointF &pos, bool onlySelectable=false) const;\n  bool hasPlottable(QCPAbstractPlottable *plottable) const;\n \n  // specialized interface for QCPGraph:\n  QCPGraph *graph(int index) const;\n  QCPGraph *graph() const;\n  QCPGraph *addGraph(QCPAxis *keyAxis=0, QCPAxis *valueAxis=0);\n  bool removeGraph(QCPGraph *graph);\n  bool removeGraph(int index);\n  int clearGraphs();\n  int graphCount() const;\n  QList<QCPGraph*> selectedGraphs() const;\n\n  // item interface:\n  QCPAbstractItem *item(int index) const;\n  QCPAbstractItem *item() const;\n  bool addItem(QCPAbstractItem* item);\n  bool removeItem(QCPAbstractItem *item);\n  bool removeItem(int index);\n  int clearItems();\n  int itemCount() const;\n  QList<QCPAbstractItem*> selectedItems() const;\n  QCPAbstractItem *itemAt(const QPointF &pos, bool onlySelectable=false) const;\n  bool hasItem(QCPAbstractItem *item) const;\n  \n  // layer interface:\n  QCPLayer *layer(const QString &name) const;\n  QCPLayer *layer(int index) const;\n  QCPLayer *currentLayer() const;\n  bool setCurrentLayer(const QString &name);\n  bool setCurrentLayer(QCPLayer *layer);\n  int layerCount() const;\n  bool addLayer(const QString &name, QCPLayer *otherLayer=0, LayerInsertMode insertMode=limAbove);\n  bool removeLayer(QCPLayer *layer);\n  bool moveLayer(QCPLayer *layer, QCPLayer *otherLayer, LayerInsertMode insertMode=limAbove);\n  \n  // axis rect/layout interface:\n  int axisRectCount() const;\n  QCPAxisRect* axisRect(int index=0) const;\n  QList<QCPAxisRect*> axisRects() const;\n  QCPLayoutElement* layoutElementAt(const QPointF &pos) const;\n  Q_SLOT void rescaleAxes(bool onlyVisiblePlottables=false);\n  \n  QList<QCPAxis*> selectedAxes() const;\n  QList<QCPLegend*> selectedLegends() const;\n  Q_SLOT void deselectAll();\n  \n  bool savePdf(const QString &fileName, bool noCosmeticPen=false, int width=0, int height=0, const QString &pdfCreator=\"\", const QString &pdfTitle=\"\");\n  bool savePng(const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1);\n  bool saveJpg(const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1);\n  bool saveBmp(const QString &fileName, int width=0, int height=0, double scale=1.0);\n  bool saveRastered(const QString &fileName, int width, int height, double scale, const char *format, int quality=-1);\n  QPixmap toPixmap(int width=0, int height=0, double scale=1.0);\n  void toPainter(QCPPainter *painter, int width=0, int height=0);\n  Q_SLOT void replot(QCustomPlot::RefreshPriority refreshPriority=QCustomPlot::rpHint);\n  \n  QCPAxis *xAxis, *yAxis, *xAxis2, *yAxis2;\n  QCPLegend *legend;\n  \nsignals:\n  void mouseDoubleClick(QMouseEvent *event);\n  void mousePress(QMouseEvent *event);\n  void mouseMove(QMouseEvent *event);\n  void mouseRelease(QMouseEvent *event);\n  void mouseWheel(QWheelEvent *event);\n  \n  void plottableClick(QCPAbstractPlottable *plottable, QMouseEvent *event);\n  void plottableDoubleClick(QCPAbstractPlottable *plottable, QMouseEvent *event);\n  void itemClick(QCPAbstractItem *item, QMouseEvent *event);\n  void itemDoubleClick(QCPAbstractItem *item, QMouseEvent *event);\n  void axisClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event);\n  void axisDoubleClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event);\n  void legendClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event);\n  void legendDoubleClick(QCPLegend *legend,  QCPAbstractLegendItem *item, QMouseEvent *event);\n  void titleClick(QMouseEvent *event, QCPPlotTitle *title);\n  void titleDoubleClick(QMouseEvent *event, QCPPlotTitle *title);\n  \n  void selectionChangedByUser();\n  void beforeReplot();\n  void afterReplot();\n  \nprotected:\n  // property members:\n  QRect mViewport;\n  QCPLayoutGrid *mPlotLayout;\n  bool mAutoAddPlottableToLegend;\n  QList<QCPAbstractPlottable*> mPlottables;\n  QList<QCPGraph*> mGraphs; // extra list of plottables also in mPlottables that are of type QCPGraph\n  QList<QCPAbstractItem*> mItems;\n  QList<QCPLayer*> mLayers;\n  QCP::AntialiasedElements mAntialiasedElements, mNotAntialiasedElements;\n  QCP::Interactions mInteractions;\n  int mSelectionTolerance;\n  bool mNoAntialiasingOnDrag;\n  QBrush mBackgroundBrush;\n  QPixmap mBackgroundPixmap;\n  QPixmap mScaledBackgroundPixmap;\n  bool mBackgroundScaled;\n  Qt::AspectRatioMode mBackgroundScaledMode;\n  QCPLayer *mCurrentLayer;\n  QCP::PlottingHints mPlottingHints;\n  Qt::KeyboardModifier mMultiSelectModifier;\n  \n  // non-property members:\n  QPixmap mPaintBuffer;\n  QPoint mMousePressPos;\n  QPointer<QCPLayoutElement> mMouseEventElement;\n  bool mReplotting;\n  \n  // reimplemented virtual methods:\n  virtual QSize minimumSizeHint() const;\n  virtual QSize sizeHint() const;\n  virtual void paintEvent(QPaintEvent *event);\n  virtual void resizeEvent(QResizeEvent *event);\n  virtual void mouseDoubleClickEvent(QMouseEvent *event);\n  virtual void mousePressEvent(QMouseEvent *event);\n  virtual void mouseMoveEvent(QMouseEvent *event);\n  virtual void mouseReleaseEvent(QMouseEvent *event);\n  virtual void wheelEvent(QWheelEvent *event);\n  \n  // introduced virtual methods:\n  virtual void draw(QCPPainter *painter);\n  virtual void axisRemoved(QCPAxis *axis);\n  virtual void legendRemoved(QCPLegend *legend);\n  \n  // non-virtual methods:\n  void updateLayerIndices() const;\n  QCPLayerable *layerableAt(const QPointF &pos, bool onlySelectable, QVariant *selectionDetails=0) const;\n  void drawBackground(QCPPainter *painter);\n  \n  friend class QCPLegend;\n  friend class QCPAxis;\n  friend class QCPLayer;\n  friend class QCPAxisRect;\n};\n\n\nclass QCP_LIB_DECL QCPColorGradient\n{\n  Q_GADGET\npublic:\n  /*!\n    Defines the color spaces in which color interpolation between gradient stops can be performed.\n    \n    \\see setColorInterpolation\n  */\n  enum ColorInterpolation { ciRGB  ///< Color channels red, green and blue are linearly interpolated\n                            ,ciHSV ///< Color channels hue, saturation and value are linearly interpolated (The hue is interpolated over the shortest angle distance)\n                          };\n  Q_ENUMS(ColorInterpolation)\n  \n  /*!\n    Defines the available presets that can be loaded with \\ref loadPreset. See the documentation\n    there for an image of the presets.\n  */\n  enum GradientPreset { gpGrayscale  ///< Continuous lightness from black to white (suited for non-biased data representation)\n                        ,gpHot       ///< Continuous lightness from black over firey colors to white (suited for non-biased data representation)\n                        ,gpCold      ///< Continuous lightness from black over icey colors to white (suited for non-biased data representation)\n                        ,gpNight     ///< Continuous lightness from black over weak blueish colors to white (suited for non-biased data representation)\n                        ,gpCandy     ///< Blue over pink to white\n                        ,gpGeography ///< Colors suitable to represent different elevations on geographical maps\n                        ,gpIon       ///< Half hue spectrum from black over purple to blue and finally green (creates banding illusion but allows more precise magnitude estimates)\n                        ,gpThermal   ///< Colors suitable for thermal imaging, ranging from dark blue over purple to orange, yellow and white\n                        ,gpPolar     ///< Colors suitable to emphasize polarity around the center, with blue for negative, black in the middle and red for positive values\n                        ,gpSpectrum  ///< An approximation of the visible light spectrum (creates banding illusion but allows more precise magnitude estimates)\n                        ,gpJet       ///< Hue variation similar to a spectrum, often used in numerical visualization (creates banding illusion but allows more precise magnitude estimates)\n                        ,gpHues      ///< Full hue cycle, with highest and lowest color red (suitable for periodic data, such as angles and phases, see \\ref setPeriodic)\n                      };\n  Q_ENUMS(GradientPreset)\n  \n  QCPColorGradient(GradientPreset preset=gpCold);\n  bool operator==(const QCPColorGradient &other) const;\n  bool operator!=(const QCPColorGradient &other) const { return !(*this == other); }\n  \n  // getters:\n  int levelCount() const { return mLevelCount; }\n  QMap<double, QColor> colorStops() const { return mColorStops; }\n  ColorInterpolation colorInterpolation() const { return mColorInterpolation; }\n  bool periodic() const { return mPeriodic; }\n  \n  // setters:\n  void setLevelCount(int n);\n  void setColorStops(const QMap<double, QColor> &colorStops);\n  void setColorStopAt(double position, const QColor &color);\n  void setColorInterpolation(ColorInterpolation interpolation);\n  void setPeriodic(bool enabled);\n  \n  // non-property methods:\n  void colorize(const double *data, const QCPRange &range, QRgb *scanLine, int n, int dataIndexFactor=1, bool logarithmic=false);\n  QRgb color(double position, const QCPRange &range, bool logarithmic=false);\n  void loadPreset(GradientPreset preset);\n  void clearColorStops();\n  QCPColorGradient inverted() const;\n  \nprotected:\n  void updateColorBuffer();\n  \n  // property members:\n  int mLevelCount;\n  QMap<double, QColor> mColorStops;\n  ColorInterpolation mColorInterpolation;\n  bool mPeriodic;\n  \n  // non-property members:\n  QVector<QRgb> mColorBuffer;\n  bool mColorBufferInvalidated;\n};\n\n\nclass QCP_LIB_DECL QCPAxisRect : public QCPLayoutElement\n{\n  Q_OBJECT\n  /// \\cond INCLUDE_QPROPERTIES\n  Q_PROPERTY(QPixmap background READ background WRITE setBackground)\n  Q_PROPERTY(bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled)\n  Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode)\n  Q_PROPERTY(Qt::Orientations rangeDrag READ rangeDrag WRITE setRangeDrag)\n  Q_PROPERTY(Qt::Orientations rangeZoom READ rangeZoom WRITE setRangeZoom)\n  /// \\endcond\npublic:\n  explicit QCPAxisRect(QCustomPlot *parentPlot, bool setupDefaultAxes=true);\n  virtual ~QCPAxisRect();\n  \n  // getters:\n  QPixmap background() const { return mBackgroundPixmap; }\n  bool backgroundScaled() const { return mBackgroundScaled; }\n  Qt::AspectRatioMode backgroundScaledMode() const { return mBackgroundScaledMode; }\n  Qt::Orientations rangeDrag() const { return mRangeDrag; }\n  Qt::Orientations rangeZoom() const { return mRangeZoom; }\n  QCPAxis *rangeDragAxis(Qt::Orientation orientation);\n  QCPAxis *rangeZoomAxis(Qt::Orientation orientation);\n  double rangeZoomFactor(Qt::Orientation orientation);\n  \n  // setters:\n  void setBackground(const QPixmap &pm);\n  void setBackground(const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding);\n  void setBackground(const QBrush &brush);\n  void setBackgroundScaled(bool scaled);\n  void setBackgroundScaledMode(Qt::AspectRatioMode mode);\n  void setRangeDrag(Qt::Orientations orientations);\n  void setRangeZoom(Qt::Orientations orientations);\n  void setRangeDragAxes(QCPAxis *horizontal, QCPAxis *vertical);\n  void setRangeZoomAxes(QCPAxis *horizontal, QCPAxis *vertical);\n  void setRangeZoomFactor(double horizontalFactor, double verticalFactor);\n  void setRangeZoomFactor(double factor);\n  \n  // non-property methods:\n  int axisCount(QCPAxis::AxisType type) const;\n  QCPAxis *axis(QCPAxis::AxisType type, int index=0) const;\n  QList<QCPAxis*> axes(QCPAxis::AxisTypes types) const;\n  QList<QCPAxis*> axes() const;\n  QCPAxis *addAxis(QCPAxis::AxisType type);\n  QList<QCPAxis*> addAxes(QCPAxis::AxisTypes types);\n  bool removeAxis(QCPAxis *axis);\n  QCPLayoutInset *insetLayout() const { return mInsetLayout; }\n  \n  void setupFullAxesBox(bool connectRanges=false);\n  QList<QCPAbstractPlottable*> plottables() const;\n  QList<QCPGraph*> graphs() const;\n  QList<QCPAbstractItem*> items() const;\n  \n  // read-only interface imitating a QRect:\n  int left() const { return mRect.left(); }\n  int right() const { return mRect.right(); }\n  int top() const { return mRect.top(); }\n  int bottom() const { return mRect.bottom(); }\n  int width() const { return mRect.width(); }\n  int height() const { return mRect.height(); }\n  QSize size() const { return mRect.size(); }\n  QPoint topLeft() const { return mRect.topLeft(); }\n  QPoint topRight() const { return mRect.topRight(); }\n  QPoint bottomLeft() const { return mRect.bottomLeft(); }\n  QPoint bottomRight() const { return mRect.bottomRight(); }\n  QPoint center() const { return mRect.center(); }\n  \n  // reimplemented virtual methods:\n  virtual void update(UpdatePhase phase);\n  virtual QList<QCPLayoutElement*> elements(bool recursive) const;\n\nprotected:\n  // property members:\n  QBrush mBackgroundBrush;\n  QPixmap mBackgroundPixmap;\n  QPixmap mScaledBackgroundPixmap;\n  bool mBackgroundScaled;\n  Qt::AspectRatioMode mBackgroundScaledMode;\n  QCPLayoutInset *mInsetLayout;\n  Qt::Orientations mRangeDrag, mRangeZoom;\n  QPointer<QCPAxis> mRangeDragHorzAxis, mRangeDragVertAxis, mRangeZoomHorzAxis, mRangeZoomVertAxis;\n  double mRangeZoomFactorHorz, mRangeZoomFactorVert;\n  // non-property members:\n  QCPRange mDragStartHorzRange, mDragStartVertRange;\n  QCP::AntialiasedElements mAADragBackup, mNotAADragBackup;\n  QPoint mDragStart;\n  bool mDragging;\n  QHash<QCPAxis::AxisType, QList<QCPAxis*> > mAxes;\n  \n  // reimplemented virtual methods:\n  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;\n  virtual void draw(QCPPainter *painter);\n  virtual int calculateAutoMargin(QCP::MarginSide side);\n  // events:\n  virtual void mousePressEvent(QMouseEvent *event);\n  virtual void mouseMoveEvent(QMouseEvent *event);\n  virtual void mouseReleaseEvent(QMouseEvent *event);\n  virtual void wheelEvent(QWheelEvent *event);\n  \n  // non-property methods:\n  void drawBackground(QCPPainter *painter);\n  void updateAxesOffset(QCPAxis::AxisType type);\n  \nprivate:\n  Q_DISABLE_COPY(QCPAxisRect)\n  \n  friend class QCustomPlot;\n};\n\n\nclass QCP_LIB_DECL QCPAbstractLegendItem : public QCPLayoutElement\n{\n  Q_OBJECT\n  /// \\cond INCLUDE_QPROPERTIES\n  Q_PROPERTY(QCPLegend* parentLegend READ parentLegend)\n  Q_PROPERTY(QFont font READ font WRITE setFont)\n  Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)\n  Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)\n  Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)\n  Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY selectionChanged)\n  Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectableChanged)\n  /// \\endcond\npublic:\n  explicit QCPAbstractLegendItem(QCPLegend *parent);\n  \n  // getters:\n  QCPLegend *parentLegend() const { return mParentLegend; }\n  QFont font() const { return mFont; }\n  QColor textColor() const { return mTextColor; }\n  QFont selectedFont() const { return mSelectedFont; }\n  QColor selectedTextColor() const { return mSelectedTextColor; }\n  bool selectable() const { return mSelectable; }\n  bool selected() const { return mSelected; }\n  \n  // setters:\n  void setFont(const QFont &font);\n  void setTextColor(const QColor &color);\n  void setSelectedFont(const QFont &font);\n  void setSelectedTextColor(const QColor &color);\n  Q_SLOT void setSelectable(bool selectable);\n  Q_SLOT void setSelected(bool selected);\n  \n  // reimplemented virtual methods:\n  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;\n  \nsignals:\n  void selectionChanged(bool selected);\n  void selectableChanged(bool selectable);\n  \nprotected:\n  // property members:\n  QCPLegend *mParentLegend;\n  QFont mFont;\n  QColor mTextColor;\n  QFont mSelectedFont;\n  QColor mSelectedTextColor;\n  bool mSelectable, mSelected;\n  \n  // reimplemented virtual methods:\n  virtual QCP::Interaction selectionCategory() const;\n  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;\n  virtual QRect clipRect() const;\n  virtual void draw(QCPPainter *painter) = 0;\n  // events:\n  virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);\n  virtual void deselectEvent(bool *selectionStateChanged);\n  \nprivate:\n  Q_DISABLE_COPY(QCPAbstractLegendItem)\n  \n  friend class QCPLegend;\n};\n\n\nclass QCP_LIB_DECL QCPPlottableLegendItem : public QCPAbstractLegendItem\n{\n  Q_OBJECT\npublic:\n  QCPPlottableLegendItem(QCPLegend *parent, QCPAbstractPlottable *plottable);\n  \n  // getters:\n  QCPAbstractPlottable *plottable() { return mPlottable; }\n  \nprotected:\n  // property members:\n  QCPAbstractPlottable *mPlottable;\n  \n  // reimplemented virtual methods:\n  virtual void draw(QCPPainter *painter);\n  virtual QSize minimumSizeHint() const;\n  \n  // non-virtual methods:\n  QPen getIconBorderPen() const;\n  QColor getTextColor() const;\n  QFont getFont() const;\n};\n\n\nclass QCP_LIB_DECL QCPLegend : public QCPLayoutGrid\n{\n  Q_OBJECT\n  /// \\cond INCLUDE_QPROPERTIES\n  Q_PROPERTY(QPen borderPen READ borderPen WRITE setBorderPen)\n  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)\n  Q_PROPERTY(QFont font READ font WRITE setFont)\n  Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)\n  Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize)\n  Q_PROPERTY(int iconTextPadding READ iconTextPadding WRITE setIconTextPadding)\n  Q_PROPERTY(QPen iconBorderPen READ iconBorderPen WRITE setIconBorderPen)\n  Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE setSelectableParts NOTIFY selectionChanged)\n  Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE setSelectedParts NOTIFY selectableChanged)\n  Q_PROPERTY(QPen selectedBorderPen READ selectedBorderPen WRITE setSelectedBorderPen)\n  Q_PROPERTY(QPen selectedIconBorderPen READ selectedIconBorderPen WRITE setSelectedIconBorderPen)\n  Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)\n  Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)\n  Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)\n  /// \\endcond\npublic:\n  /*!\n    Defines the selectable parts of a legend\n    \n    \\see setSelectedParts, setSelectableParts\n  */\n  enum SelectablePart { spNone       = 0x000  ///< <tt>0x000</tt> None\n                        ,spLegendBox  = 0x001 ///< <tt>0x001</tt> The legend box (frame)\n                        ,spItems      = 0x002 ///< <tt>0x002</tt> Legend items individually (see \\ref selectedItems)\n                      };\n  Q_FLAGS(SelectablePart SelectableParts)\n  Q_DECLARE_FLAGS(SelectableParts, SelectablePart)\n  \n  explicit QCPLegend();\n  virtual ~QCPLegend();\n  \n  // getters:\n  QPen borderPen() const { return mBorderPen; }\n  QBrush brush() const { return mBrush; }\n  QFont font() const { return mFont; }\n  QColor textColor() const { return mTextColor; }\n  QSize iconSize() const { return mIconSize; }\n  int iconTextPadding() const { return mIconTextPadding; }\n  QPen iconBorderPen() const { return mIconBorderPen; }\n  SelectableParts selectableParts() const { return mSelectableParts; }\n  SelectableParts selectedParts() const;\n  QPen selectedBorderPen() const { return mSelectedBorderPen; }\n  QPen selectedIconBorderPen() const { return mSelectedIconBorderPen; }\n  QBrush selectedBrush() const { return mSelectedBrush; }\n  QFont selectedFont() const { return mSelectedFont; }\n  QColor selectedTextColor() const { return mSelectedTextColor; }\n  \n  // setters:\n  void setBorderPen(const QPen &pen);\n  void setBrush(const QBrush &brush);\n  void setFont(const QFont &font);\n  void setTextColor(const QColor &color);\n  void setIconSize(const QSize &size);\n  void setIconSize(int width, int height);\n  void setIconTextPadding(int padding);\n  void setIconBorderPen(const QPen &pen);\n  Q_SLOT void setSelectableParts(const SelectableParts &selectableParts);\n  Q_SLOT void setSelectedParts(const SelectableParts &selectedParts);\n  void setSelectedBorderPen(const QPen &pen);\n  void setSelectedIconBorderPen(const QPen &pen);\n  void setSelectedBrush(const QBrush &brush);\n  void setSelectedFont(const QFont &font);\n  void setSelectedTextColor(const QColor &color);\n  \n  // reimplemented virtual methods:\n  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;\n  \n  // non-virtual methods:\n  QCPAbstractLegendItem *item(int index) const;\n  QCPPlottableLegendItem *itemWithPlottable(const QCPAbstractPlottable *plottable) const;\n  int itemCount() const;\n  bool hasItem(QCPAbstractLegendItem *item) const;\n  bool hasItemWithPlottable(const QCPAbstractPlottable *plottable) const;\n  bool addItem(QCPAbstractLegendItem *item);\n  bool removeItem(int index);\n  bool removeItem(QCPAbstractLegendItem *item);\n  void clearItems();\n  QList<QCPAbstractLegendItem*> selectedItems() const;\n  \nsignals:\n  void selectionChanged(QCPLegend::SelectableParts parts);\n  void selectableChanged(QCPLegend::SelectableParts parts);\n  \nprotected:\n  // property members:\n  QPen mBorderPen, mIconBorderPen;\n  QBrush mBrush;\n  QFont mFont;\n  QColor mTextColor;\n  QSize mIconSize;\n  int mIconTextPadding;\n  SelectableParts mSelectedParts, mSelectableParts;\n  QPen mSelectedBorderPen, mSelectedIconBorderPen;\n  QBrush mSelectedBrush;\n  QFont mSelectedFont;\n  QColor mSelectedTextColor;\n  \n  // reimplemented virtual methods:\n  virtual void parentPlotInitialized(QCustomPlot *parentPlot);\n  virtual QCP::Interaction selectionCategory() const;\n  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;\n  virtual void draw(QCPPainter *painter);\n  // events:\n  virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);\n  virtual void deselectEvent(bool *selectionStateChanged);\n  \n  // non-virtual methods:\n  QPen getBorderPen() const;\n  QBrush getBrush() const;\n  \nprivate:\n  Q_DISABLE_COPY(QCPLegend)\n  \n  friend class QCustomPlot;\n  friend class QCPAbstractLegendItem;\n};\nQ_DECLARE_OPERATORS_FOR_FLAGS(QCPLegend::SelectableParts)\nQ_DECLARE_METATYPE(QCPLegend::SelectablePart)\n\n\nclass QCP_LIB_DECL QCPPlotTitle : public QCPLayoutElement\n{\n  Q_OBJECT\n  /// \\cond INCLUDE_QPROPERTIES\n  Q_PROPERTY(QString text READ text WRITE setText)\n  Q_PROPERTY(QFont font READ font WRITE setFont)\n  Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)\n  Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)\n  Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)\n  Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged)\n  Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectionChanged)\n  /// \\endcond\npublic:\n  explicit QCPPlotTitle(QCustomPlot *parentPlot);\n  explicit QCPPlotTitle(QCustomPlot *parentPlot, const QString &text);\n  \n  // getters:\n  QString text() const { return mText; }\n  QFont font() const { return mFont; }\n  QColor textColor() const { return mTextColor; }\n  QFont selectedFont() const { return mSelectedFont; }\n  QColor selectedTextColor() const { return mSelectedTextColor; }\n  bool selectable() const { return mSelectable; }\n  bool selected() const { return mSelected; }\n  \n  // setters:\n  void setText(const QString &text);\n  void setFont(const QFont &font);\n  void setTextColor(const QColor &color);\n  void setSelectedFont(const QFont &font);\n  void setSelectedTextColor(const QColor &color);\n  Q_SLOT void setSelectable(bool selectable);\n  Q_SLOT void setSelected(bool selected);\n  \n  // reimplemented virtual methods:\n  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;\n  \nsignals:\n  void selectionChanged(bool selected);\n  void selectableChanged(bool selectable);\n  \nprotected:\n  // property members:\n  QString mText;\n  QFont mFont;\n  QColor mTextColor;\n  QFont mSelectedFont;\n  QColor mSelectedTextColor;\n  QRect mTextBoundingRect;\n  bool mSelectable, mSelected;\n  \n  // reimplemented virtual methods:\n  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;\n  virtual void draw(QCPPainter *painter);\n  virtual QSize minimumSizeHint() const;\n  virtual QSize maximumSizeHint() const;\n  // events:\n  virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged);\n  virtual void deselectEvent(bool *selectionStateChanged);\n  \n  // non-virtual methods:\n  QFont mainFont() const;\n  QColor mainTextColor() const;\n  \nprivate:\n  Q_DISABLE_COPY(QCPPlotTitle)\n};\n\n\nclass QCPColorScaleAxisRectPrivate : public QCPAxisRect\n{\n  Q_OBJECT\npublic:\n  explicit QCPColorScaleAxisRectPrivate(QCPColorScale *parentColorScale);\nprotected:\n  QCPColorScale *mParentColorScale;\n  QImage mGradientImage;\n  bool mGradientImageInvalidated;\n  // re-using some methods of QCPAxisRect to make them available to friend class QCPColorScale\n  using QCPAxisRect::calculateAutoMargin;\n  using QCPAxisRect::mousePressEvent;\n  using QCPAxisRect::mouseMoveEvent;\n  using QCPAxisRect::mouseReleaseEvent;\n  using QCPAxisRect::wheelEvent;\n  using QCPAxisRect::update;\n  virtual void draw(QCPPainter *painter);\n  void updateGradientImage();\n  Q_SLOT void axisSelectionChanged(QCPAxis::SelectableParts selectedParts);\n  Q_SLOT void axisSelectableChanged(QCPAxis::SelectableParts selectableParts);\n  friend class QCPColorScale;\n};\n\n\nclass QCP_LIB_DECL QCPColorScale : public QCPLayoutElement\n{\n  Q_OBJECT\n  /// \\cond INCLUDE_QPROPERTIES\n  Q_PROPERTY(QCPAxis::AxisType type READ type WRITE setType)\n  Q_PROPERTY(QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY dataRangeChanged)\n  Q_PROPERTY(QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE setDataScaleType NOTIFY dataScaleTypeChanged)\n  Q_PROPERTY(QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY gradientChanged)\n  Q_PROPERTY(QString label READ label WRITE setLabel)\n  Q_PROPERTY(int barWidth READ barWidth WRITE setBarWidth)\n  Q_PROPERTY(bool rangeDrag READ rangeDrag WRITE setRangeDrag)\n  Q_PROPERTY(bool rangeZoom READ rangeZoom WRITE setRangeZoom)\n  /// \\endcond\npublic:\n  explicit QCPColorScale(QCustomPlot *parentPlot);\n  virtual ~QCPColorScale();\n  \n  // getters:\n  QCPAxis *axis() const { return mColorAxis.data(); }\n  QCPAxis::AxisType type() const { return mType; }\n  QCPRange dataRange() const { return mDataRange; }\n  QCPAxis::ScaleType dataScaleType() const { return mDataScaleType; }\n  QCPColorGradient gradient() const { return mGradient; }\n  QString label() const;\n  int barWidth () const { return mBarWidth; }\n  bool rangeDrag() const;\n  bool rangeZoom() const;\n  \n  // setters:\n  void setType(QCPAxis::AxisType type);\n  Q_SLOT void setDataRange(const QCPRange &dataRange);\n  Q_SLOT void setDataScaleType(QCPAxis::ScaleType scaleType);\n  Q_SLOT void setGradient(const QCPColorGradient &gradient);\n  void setLabel(const QString &str);\n  void setBarWidth(int width);\n  void setRangeDrag(bool enabled);\n  void setRangeZoom(bool enabled);\n  \n  // non-property methods:\n  QList<QCPColorMap*> colorMaps() const;\n  void rescaleDataRange(bool onlyVisibleMaps);\n  \n  // reimplemented virtual methods:\n  virtual void update(UpdatePhase phase);\n  \nsignals:\n  void dataRangeChanged(QCPRange newRange);\n  void dataScaleTypeChanged(QCPAxis::ScaleType scaleType);\n  void gradientChanged(QCPColorGradient newGradient);\n\nprotected:\n  // property members:\n  QCPAxis::AxisType mType;\n  QCPRange mDataRange;\n  QCPAxis::ScaleType mDataScaleType;\n  QCPColorGradient mGradient;\n  int mBarWidth;\n  \n  // non-property members:\n  QPointer<QCPColorScaleAxisRectPrivate> mAxisRect;\n  QPointer<QCPAxis> mColorAxis;\n  \n  // reimplemented virtual methods:\n  virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const;\n  // events:\n  virtual void mousePressEvent(QMouseEvent *event);\n  virtual void mouseMoveEvent(QMouseEvent *event);\n  virtual void mouseReleaseEvent(QMouseEvent *event);\n  virtual void wheelEvent(QWheelEvent *event);\n  \nprivate:\n  Q_DISABLE_COPY(QCPColorScale)\n  \n  friend class QCPColorScaleAxisRectPrivate;\n};\n\n\n/*! \\file */\n\n\n\nclass QCP_LIB_DECL QCPData\n{\npublic:\n  QCPData();\n  QCPData(double key, double value);\n  double key, value;\n  double keyErrorPlus, keyErrorMinus;\n  double valueErrorPlus, valueErrorMinus;\n};\nQ_DECLARE_TYPEINFO(QCPData, Q_MOVABLE_TYPE);\n\n/*! \\typedef QCPDataMap\n  Container for storing QCPData items in a sorted fashion. The key of the map\n  is the key member of the QCPData instance.\n  \n  This is the container in which QCPGraph holds its data.\n  \\see QCPData, QCPGraph::setData\n*/\ntypedef QMap<double, QCPData> QCPDataMap;\ntypedef QMapIterator<double, QCPData> QCPDataMapIterator;\ntypedef QMutableMapIterator<double, QCPData> QCPDataMutableMapIterator;\n\n\nclass QCP_LIB_DECL QCPGraph : public QCPAbstractPlottable\n{\n  Q_OBJECT\n  /// \\cond INCLUDE_QPROPERTIES\n  Q_PROPERTY(LineStyle lineStyle READ lineStyle WRITE setLineStyle)\n  Q_PROPERTY(QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle)\n  Q_PROPERTY(ErrorType errorType READ errorType WRITE setErrorType)\n  Q_PROPERTY(QPen errorPen READ errorPen WRITE setErrorPen)\n  Q_PROPERTY(double errorBarSize READ errorBarSize WRITE setErrorBarSize)\n  Q_PROPERTY(bool errorBarSkipSymbol READ errorBarSkipSymbol WRITE setErrorBarSkipSymbol)\n  Q_PROPERTY(QCPGraph* channelFillGraph READ channelFillGraph WRITE setChannelFillGraph)\n  Q_PROPERTY(bool adaptiveSampling READ adaptiveSampling WRITE setAdaptiveSampling)\n  /// \\endcond\npublic:\n  /*!\n    Defines how the graph's line is represented visually in the plot. The line is drawn with the\n    current pen of the graph (\\ref setPen).\n    \\see setLineStyle\n  */\n  enum LineStyle { lsNone        ///< data points are not connected with any lines (e.g. data only represented\n                                 ///< with symbols according to the scatter style, see \\ref setScatterStyle)\n                   ,lsLine       ///< data points are connected by a straight line\n                   ,lsStepLeft   ///< line is drawn as steps where the step height is the value of the left data point\n                   ,lsStepRight  ///< line is drawn as steps where the step height is the value of the right data point\n                   ,lsStepCenter ///< line is drawn as steps where the step is in between two data points\n                   ,lsImpulse    ///< each data point is represented by a line parallel to the value axis, which reaches from the data point to the zero-value-line\n                 };\n  Q_ENUMS(LineStyle)\n  /*!\n    Defines what kind of error bars are drawn for each data point\n  */\n  enum ErrorType { etNone   ///< No error bars are shown\n                   ,etKey   ///< Error bars for the key dimension of the data point are shown\n                   ,etValue ///< Error bars for the value dimension of the data point are shown\n                   ,etBoth  ///< Error bars for both key and value dimensions of the data point are shown\n                 };\n  Q_ENUMS(ErrorType)\n  \n  explicit QCPGraph(QCPAxis *keyAxis, QCPAxis *valueAxis);\n  virtual ~QCPGraph();\n  \n  // getters:\n  QCPDataMap *data() const { return mData; }\n  LineStyle lineStyle() const { return mLineStyle; }\n  QCPScatterStyle scatterStyle() const { return mScatterStyle; }\n  ErrorType errorType() const { return mErrorType; }\n  QPen errorPen() const { return mErrorPen; }\n  double errorBarSize() const { return mErrorBarSize; }\n  bool errorBarSkipSymbol() const { return mErrorBarSkipSymbol; }\n  QCPGraph *channelFillGraph() const { return mChannelFillGraph.data(); }\n  bool adaptiveSampling() const { return mAdaptiveSampling; }\n  \n  // setters:\n  void setData(QCPDataMap *data, bool copy=false);\n  void setData(const QVector<double> &key, const QVector<double> &value);\n  void setDataKeyError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &keyError);\n  void setDataKeyError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &keyErrorMinus, const QVector<double> &keyErrorPlus);\n  void setDataValueError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &valueError);\n  void setDataValueError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &valueErrorMinus, const QVector<double> &valueErrorPlus);\n  void setDataBothError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &keyError, const QVector<double> &valueError);\n  void setDataBothError(const QVector<double> &key, const QVector<double> &value, const QVector<double> &keyErrorMinus, const QVector<double> &keyErrorPlus, const QVector<double> &valueErrorMinus, const QVector<double> &valueErrorPlus);\n  void setLineStyle(LineStyle ls);\n  void setScatterStyle(const QCPScatterStyle &style);\n  void setErrorType(ErrorType errorType);\n  void setErrorPen(const QPen &pen);\n  void setErrorBarSize(double size);\n  void setErrorBarSkipSymbol(bool enabled);\n  void setChannelFillGraph(QCPGraph *targetGraph);\n  void setAdaptiveSampling(bool enabled);\n  \n  // non-property methods:\n  void addData(const QCPDataMap &dataMap);\n  void addData(const QCPData &data);\n  void addData(double key, double value);\n  void addData(const QVector<double> &keys, const QVector<double> &values);\n  void removeDataBefore(double key);\n  void removeDataAfter(double key);\n  void removeData(double fromKey, double toKey);\n  void removeData(double key);\n  \n  // reimplemented virtual methods:\n  virtual void clearData();\n  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;\n  using QCPAbstractPlottable::rescaleAxes;\n  using QCPAbstractPlottable::rescaleKeyAxis;\n  using QCPAbstractPlottable::rescaleValueAxis;\n  void rescaleAxes(bool onlyEnlarge, bool includeErrorBars) const; // overloads base class interface\n  void rescaleKeyAxis(bool onlyEnlarge, bool includeErrorBars) const; // overloads base class interface\n  void rescaleValueAxis(bool onlyEnlarge, bool includeErrorBars) const; // overloads base class interface\n  \nprotected:\n  // property members:\n  QCPDataMap *mData;\n  QPen mErrorPen;\n  LineStyle mLineStyle;\n  QCPScatterStyle mScatterStyle;\n  ErrorType mErrorType;\n  double mErrorBarSize;\n  bool mErrorBarSkipSymbol;\n  QPointer<QCPGraph> mChannelFillGraph;\n  bool mAdaptiveSampling;\n  \n  // reimplemented virtual methods:\n  virtual void draw(QCPPainter *painter);\n  virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;\n  virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const;\n  virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const;\n  virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain, bool includeErrors) const; // overloads base class interface\n  virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain, bool includeErrors) const; // overloads base class interface\n  \n  // introduced virtual methods:\n  virtual void drawFill(QCPPainter *painter, QVector<QPointF> *lineData) const;\n  virtual void drawScatterPlot(QCPPainter *painter, QVector<QCPData> *scatterData) const;\n  virtual void drawLinePlot(QCPPainter *painter, QVector<QPointF> *lineData) const;\n  virtual void drawImpulsePlot(QCPPainter *painter, QVector<QPointF> *lineData) const;\n  \n  // non-virtual methods:\n  void getPreparedData(QVector<QCPData> *lineData, QVector<QCPData> *scatterData) const;\n  void getPlotData(QVector<QPointF> *lineData, QVector<QCPData> *scatterData) const;\n  void getScatterPlotData(QVector<QCPData> *scatterData) const;\n  void getLinePlotData(QVector<QPointF> *linePixelData, QVector<QCPData> *scatterData) const;\n  void getStepLeftPlotData(QVector<QPointF> *linePixelData, QVector<QCPData> *scatterData) const;\n  void getStepRightPlotData(QVector<QPointF> *linePixelData, QVector<QCPData> *scatterData) const;\n  void getStepCenterPlotData(QVector<QPointF> *linePixelData, QVector<QCPData> *scatterData) const;\n  void getImpulsePlotData(QVector<QPointF> *linePixelData, QVector<QCPData> *scatterData) const;\n  void drawError(QCPPainter *painter, double x, double y, const QCPData &data) const;\n  void getVisibleDataBounds(QCPDataMap::const_iterator &lower, QCPDataMap::const_iterator &upper) const;\n  int countDataInBounds(const QCPDataMap::const_iterator &lower, const QCPDataMap::const_iterator &upper, int maxCount) const;\n  void addFillBasePoints(QVector<QPointF> *lineData) const;\n  void removeFillBasePoints(QVector<QPointF> *lineData) const;\n  QPointF lowerFillBasePoint(double lowerKey) const;\n  QPointF upperFillBasePoint(double upperKey) const;\n  const QPolygonF getChannelFillPolygon(const QVector<QPointF> *lineData) const;\n  int findIndexBelowX(const QVector<QPointF> *data, double x) const;\n  int findIndexAboveX(const QVector<QPointF> *data, double x) const;\n  int findIndexBelowY(const QVector<QPointF> *data, double y) const;\n  int findIndexAboveY(const QVector<QPointF> *data, double y) const;\n  double pointDistance(const QPointF &pixelPoint) const;\n  \n  friend class QCustomPlot;\n  friend class QCPLegend;\n};\n\n\n/*! \\file */\n\n\n\nclass QCP_LIB_DECL QCPCurveData\n{\npublic:\n  QCPCurveData();\n  QCPCurveData(double t, double key, double value);\n  double t, key, value;\n};\nQ_DECLARE_TYPEINFO(QCPCurveData, Q_MOVABLE_TYPE);\n\n/*! \\typedef QCPCurveDataMap\n  Container for storing QCPCurveData items in a sorted fashion. The key of the map\n  is the t member of the QCPCurveData instance.\n  \n  This is the container in which QCPCurve holds its data.\n  \\see QCPCurveData, QCPCurve::setData\n*/\n\ntypedef QMap<double, QCPCurveData> QCPCurveDataMap;\ntypedef QMapIterator<double, QCPCurveData> QCPCurveDataMapIterator;\ntypedef QMutableMapIterator<double, QCPCurveData> QCPCurveDataMutableMapIterator;\n\n\nclass QCP_LIB_DECL QCPCurve : public QCPAbstractPlottable\n{\n  Q_OBJECT\n  /// \\cond INCLUDE_QPROPERTIES\n  Q_PROPERTY(QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle)\n  Q_PROPERTY(LineStyle lineStyle READ lineStyle WRITE setLineStyle)\n  /// \\endcond\npublic:\n  /*!\n    Defines how the curve's line is represented visually in the plot. The line is drawn with the\n    current pen of the curve (\\ref setPen).\n    \\see setLineStyle\n  */\n  enum LineStyle { lsNone  ///< No line is drawn between data points (e.g. only scatters)\n                   ,lsLine ///< Data points are connected with a straight line\n                 };\n  explicit QCPCurve(QCPAxis *keyAxis, QCPAxis *valueAxis);\n  virtual ~QCPCurve();\n  \n  // getters:\n  QCPCurveDataMap *data() const { return mData; }\n  QCPScatterStyle scatterStyle() const { return mScatterStyle; }\n  LineStyle lineStyle() const { return mLineStyle; }\n  \n  // setters:\n  void setData(QCPCurveDataMap *data, bool copy=false);\n  void setData(const QVector<double> &t, const QVector<double> &key, const QVector<double> &value);\n  void setData(const QVector<double> &key, const QVector<double> &value);\n  void setScatterStyle(const QCPScatterStyle &style);\n  void setLineStyle(LineStyle style);\n  \n  // non-property methods:\n  void addData(const QCPCurveDataMap &dataMap);\n  void addData(const QCPCurveData &data);\n  void addData(double t, double key, double value);\n  void addData(double key, double value);\n  void addData(const QVector<double> &ts, const QVector<double> &keys, const QVector<double> &values);\n  void removeDataBefore(double t);\n  void removeDataAfter(double t);\n  void removeData(double fromt, double tot);\n  void removeData(double t);\n  \n  // reimplemented virtual methods:\n  virtual void clearData();\n  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;\n  \nprotected:\n  // property members:\n  QCPCurveDataMap *mData;\n  QCPScatterStyle mScatterStyle;\n  LineStyle mLineStyle;\n  \n  // reimplemented virtual methods:\n  virtual void draw(QCPPainter *painter);\n  virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;\n  virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const;\n  virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const;\n  \n  // introduced virtual methods:\n  virtual void drawScatterPlot(QCPPainter *painter, const QVector<QPointF> *pointData) const;\n  \n  // non-virtual methods:\n  void getCurveData(QVector<QPointF> *lineData) const;\n  double pointDistance(const QPointF &pixelPoint) const;\n  QPointF outsideCoordsToPixels(double key, double value, int region, QRect axisRect) const;\n  \n  friend class QCustomPlot;\n  friend class QCPLegend;\n};\n\n\n/*! \\file */\n\n\n\nclass QCP_LIB_DECL QCPBarData\n{\npublic:\n  QCPBarData();\n  QCPBarData(double key, double value);\n  double key, value;\n};\nQ_DECLARE_TYPEINFO(QCPBarData, Q_MOVABLE_TYPE);\n\n/*! \\typedef QCPBarDataMap\n  Container for storing QCPBarData items in a sorted fashion. The key of the map\n  is the key member of the QCPBarData instance.\n  \n  This is the container in which QCPBars holds its data.\n  \\see QCPBarData, QCPBars::setData\n*/\ntypedef QMap<double, QCPBarData> QCPBarDataMap;\ntypedef QMapIterator<double, QCPBarData> QCPBarDataMapIterator;\ntypedef QMutableMapIterator<double, QCPBarData> QCPBarDataMutableMapIterator;\n\n\nclass QCP_LIB_DECL QCPBars : public QCPAbstractPlottable\n{\n  Q_OBJECT\n  /// \\cond INCLUDE_QPROPERTIES\n  Q_PROPERTY(double width READ width WRITE setWidth)\n  Q_PROPERTY(QCPBars* barBelow READ barBelow)\n  Q_PROPERTY(QCPBars* barAbove READ barAbove)\n  /// \\endcond\npublic:\n  explicit QCPBars(QCPAxis *keyAxis, QCPAxis *valueAxis);\n  virtual ~QCPBars();\n  \n  // getters:\n  double width() const { return mWidth; }\n  QCPBars *barBelow() const { return mBarBelow.data(); }\n  QCPBars *barAbove() const { return mBarAbove.data(); }\n  QCPBarDataMap *data() const { return mData; }\n  \n  // setters:\n  void setWidth(double width);\n  void setData(QCPBarDataMap *data, bool copy=false);\n  void setData(const QVector<double> &key, const QVector<double> &value);\n  \n  // non-property methods:\n  void moveBelow(QCPBars *bars);\n  void moveAbove(QCPBars *bars);\n  void addData(const QCPBarDataMap &dataMap);\n  void addData(const QCPBarData &data);\n  void addData(double key, double value);\n  void addData(const QVector<double> &keys, const QVector<double> &values);\n  void removeDataBefore(double key);\n  void removeDataAfter(double key);\n  void removeData(double fromKey, double toKey);\n  void removeData(double key);\n  \n  // reimplemented virtual methods:\n  virtual void clearData();\n  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;\n  \nprotected:\n  // property members:\n  QCPBarDataMap *mData;\n  double mWidth;\n  QPointer<QCPBars> mBarBelow, mBarAbove;\n  \n  // reimplemented virtual methods:\n  virtual void draw(QCPPainter *painter);\n  virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;\n  virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const;\n  virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const;\n  \n  // non-virtual methods:\n  QPolygonF getBarPolygon(double key, double value) const;\n  double getBaseValue(double key, bool positive) const;\n  static void connectBars(QCPBars* lower, QCPBars* upper);\n  \n  friend class QCustomPlot;\n  friend class QCPLegend;\n};\n\n\n/*! \\file */\n\n\n\nclass QCP_LIB_DECL QCPStatisticalBox : public QCPAbstractPlottable\n{\n  Q_OBJECT\n  /// \\cond INCLUDE_QPROPERTIES\n  Q_PROPERTY(double key READ key WRITE setKey)\n  Q_PROPERTY(double minimum READ minimum WRITE setMinimum)\n  Q_PROPERTY(double lowerQuartile READ lowerQuartile WRITE setLowerQuartile)\n  Q_PROPERTY(double median READ median WRITE setMedian)\n  Q_PROPERTY(double upperQuartile READ upperQuartile WRITE setUpperQuartile)\n  Q_PROPERTY(double maximum READ maximum WRITE setMaximum)\n  Q_PROPERTY(QVector<double> outliers READ outliers WRITE setOutliers)\n  Q_PROPERTY(double width READ width WRITE setWidth)\n  Q_PROPERTY(double whiskerWidth READ whiskerWidth WRITE setWhiskerWidth)\n  Q_PROPERTY(QPen whiskerPen READ whiskerPen WRITE setWhiskerPen)\n  Q_PROPERTY(QPen whiskerBarPen READ whiskerBarPen WRITE setWhiskerBarPen)\n  Q_PROPERTY(QPen medianPen READ medianPen WRITE setMedianPen)\n  Q_PROPERTY(QCPScatterStyle outlierStyle READ outlierStyle WRITE setOutlierStyle)\n  /// \\endcond\npublic:\n  explicit QCPStatisticalBox(QCPAxis *keyAxis, QCPAxis *valueAxis);\n  \n  // getters:\n  double key() const { return mKey; }\n  double minimum() const { return mMinimum; }\n  double lowerQuartile() const { return mLowerQuartile; }\n  double median() const { return mMedian; }\n  double upperQuartile() const { return mUpperQuartile; }\n  double maximum() const { return mMaximum; }\n  QVector<double> outliers() const { return mOutliers; }\n  double width() const { return mWidth; }\n  double whiskerWidth() const { return mWhiskerWidth; }\n  QPen whiskerPen() const { return mWhiskerPen; }\n  QPen whiskerBarPen() const { return mWhiskerBarPen; }\n  QPen medianPen() const { return mMedianPen; }\n  QCPScatterStyle outlierStyle() const { return mOutlierStyle; }\n\n  // setters:\n  void setKey(double key);\n  void setMinimum(double value);\n  void setLowerQuartile(double value);\n  void setMedian(double value);\n  void setUpperQuartile(double value);\n  void setMaximum(double value);\n  void setOutliers(const QVector<double> &values);\n  void setData(double key, double minimum, double lowerQuartile, double median, double upperQuartile, double maximum);\n  void setWidth(double width);\n  void setWhiskerWidth(double width);\n  void setWhiskerPen(const QPen &pen);\n  void setWhiskerBarPen(const QPen &pen);\n  void setMedianPen(const QPen &pen);\n  void setOutlierStyle(const QCPScatterStyle &style);\n  \n  // non-property methods:\n  virtual void clearData();\n  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;\n  \nprotected:\n  // property members:\n  QVector<double> mOutliers;\n  double mKey, mMinimum, mLowerQuartile, mMedian, mUpperQuartile, mMaximum;\n  double mWidth;\n  double mWhiskerWidth;\n  QPen mWhiskerPen, mWhiskerBarPen, mMedianPen;\n  QCPScatterStyle mOutlierStyle;\n  \n  // reimplemented virtual methods:\n  virtual void draw(QCPPainter *painter);\n  virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;\n  virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const;\n  virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const;\n  \n  // introduced virtual methods:\n  virtual void drawQuartileBox(QCPPainter *painter, QRectF *quartileBox=0) const;\n  virtual void drawMedian(QCPPainter *painter) const;\n  virtual void drawWhiskers(QCPPainter *painter) const;\n  virtual void drawOutliers(QCPPainter *painter) const;\n  \n  friend class QCustomPlot;\n  friend class QCPLegend;\n};\n\n\nclass QCP_LIB_DECL QCPColorMapData\n{\npublic:\n  QCPColorMapData(int keySize, int valueSize, const QCPRange &keyRange, const QCPRange &valueRange);\n  ~QCPColorMapData();\n  QCPColorMapData(const QCPColorMapData &other);\n  QCPColorMapData &operator=(const QCPColorMapData &other);\n  \n  // getters:\n  int keySize() const { return mKeySize; }\n  int valueSize() const { return mValueSize; }\n  QCPRange keyRange() const { return mKeyRange; }\n  QCPRange valueRange() const { return mValueRange; }\n  QCPRange dataBounds() const { return mDataBounds; }\n  double data(double key, double value);\n  double cell(int keyIndex, int valueIndex);\n  \n  // setters:\n  void setSize(int keySize, int valueSize);\n  void setKeySize(int keySize);\n  void setValueSize(int valueSize);\n  void setRange(const QCPRange &keyRange, const QCPRange &valueRange);\n  void setKeyRange(const QCPRange &keyRange);\n  void setValueRange(const QCPRange &valueRange);\n  void setData(double key, double value, double z);\n  void setCell(int keyIndex, int valueIndex, double z);\n  \n  // non-property methods:\n  void recalculateDataBounds();\n  void clear();\n  void fill(double z);\n  bool isEmpty() const { return mIsEmpty; }\n  void coordToCell(double key, double value, int *keyIndex, int *valueIndex) const;\n  void cellToCoord(int keyIndex, int valueIndex, double *key, double *value) const;\n  \nprotected:\n  // property members:\n  int mKeySize, mValueSize;\n  QCPRange mKeyRange, mValueRange;\n  bool mIsEmpty;\n  // non-property members:\n  double *mData;\n  QCPRange mDataBounds;\n  bool mDataModified;\n  \n  friend class QCPColorMap;\n};\n\n\nclass QCP_LIB_DECL QCPColorMap : public QCPAbstractPlottable\n{\n  Q_OBJECT\n  /// \\cond INCLUDE_QPROPERTIES\n  Q_PROPERTY(QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY dataRangeChanged)\n  Q_PROPERTY(QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE setDataScaleType NOTIFY dataScaleTypeChanged)\n  Q_PROPERTY(QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY gradientChanged)\n  Q_PROPERTY(bool interpolate READ interpolate WRITE setInterpolate)\n  Q_PROPERTY(bool tightBoundary READ tightBoundary WRITE setTightBoundary)\n  Q_PROPERTY(QCPColorScale* colorScale READ colorScale WRITE setColorScale)\n  /// \\endcond\npublic:\n  explicit QCPColorMap(QCPAxis *keyAxis, QCPAxis *valueAxis);\n  virtual ~QCPColorMap();\n  \n  // getters:\n  QCPColorMapData *data() const { return mMapData; }\n  QCPRange dataRange() const { return mDataRange; }\n  QCPAxis::ScaleType dataScaleType() const { return mDataScaleType; }\n  bool interpolate() const { return mInterpolate; }\n  bool tightBoundary() const { return mTightBoundary; }\n  QCPColorGradient gradient() const { return mGradient; }\n  QCPColorScale *colorScale() const { return mColorScale.data(); }\n  \n  // setters:\n  void setData(QCPColorMapData *data, bool copy=false);\n  Q_SLOT void setDataRange(const QCPRange &dataRange);\n  Q_SLOT void setDataScaleType(QCPAxis::ScaleType scaleType);\n  Q_SLOT void setGradient(const QCPColorGradient &gradient);\n  void setInterpolate(bool enabled);\n  void setTightBoundary(bool enabled);\n  void setColorScale(QCPColorScale *colorScale);\n  \n  // non-property methods:\n  void rescaleDataRange(bool recalculateDataBounds=false);\n  Q_SLOT void updateLegendIcon(Qt::TransformationMode transformMode=Qt::SmoothTransformation, const QSize &thumbSize=QSize(32, 18));\n  \n  // reimplemented virtual methods:\n  virtual void clearData();\n  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;\n  \nsignals:\n  void dataRangeChanged(QCPRange newRange);\n  void dataScaleTypeChanged(QCPAxis::ScaleType scaleType);\n  void gradientChanged(QCPColorGradient newGradient);\n  \nprotected:\n  // property members:\n  QCPRange mDataRange;\n  QCPAxis::ScaleType mDataScaleType;\n  QCPColorMapData *mMapData;\n  QCPColorGradient mGradient;\n  bool mInterpolate;\n  bool mTightBoundary;\n  QPointer<QCPColorScale> mColorScale;\n  // non-property members:\n  QImage mMapImage;\n  QPixmap mLegendIcon;\n  bool mMapImageInvalidated;\n  \n  // introduced virtual methods:\n  virtual void updateMapImage();\n  \n  // reimplemented virtual methods:\n  virtual void draw(QCPPainter *painter);\n  virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const;\n  virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const;\n  virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const;\n  \n  friend class QCustomPlot;\n  friend class QCPLegend;\n};\n\n\nclass QCP_LIB_DECL QCPItemStraightLine : public QCPAbstractItem\n{\n  Q_OBJECT\n  /// \\cond INCLUDE_QPROPERTIES\n  Q_PROPERTY(QPen pen READ pen WRITE setPen)\n  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)\n  /// \\endcond\npublic:\n  QCPItemStraightLine(QCustomPlot *parentPlot);\n  virtual ~QCPItemStraightLine();\n  \n  // getters:\n  QPen pen() const { return mPen; }\n  QPen selectedPen() const { return mSelectedPen; }\n  \n  // setters;\n  void setPen(const QPen &pen);\n  void setSelectedPen(const QPen &pen);\n  \n  // reimplemented virtual methods:\n  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;\n  \n  QCPItemPosition * const point1;\n  QCPItemPosition * const point2;\n  \nprotected:\n  // property members:\n  QPen mPen, mSelectedPen;\n  \n  // reimplemented virtual methods:\n  virtual void draw(QCPPainter *painter);\n  \n  // non-virtual methods:\n  double distToStraightLine(const QVector2D &point1, const QVector2D &vec, const QVector2D &point) const;\n  QLineF getRectClippedStraightLine(const QVector2D &point1, const QVector2D &vec, const QRect &rect) const;\n  QPen mainPen() const;\n};\n\n\nclass QCP_LIB_DECL QCPItemLine : public QCPAbstractItem\n{\n  Q_OBJECT\n  /// \\cond INCLUDE_QPROPERTIES\n  Q_PROPERTY(QPen pen READ pen WRITE setPen)\n  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)\n  Q_PROPERTY(QCPLineEnding head READ head WRITE setHead)\n  Q_PROPERTY(QCPLineEnding tail READ tail WRITE setTail)\n  /// \\endcond\npublic:\n  QCPItemLine(QCustomPlot *parentPlot);\n  virtual ~QCPItemLine();\n  \n  // getters:\n  QPen pen() const { return mPen; }\n  QPen selectedPen() const { return mSelectedPen; }\n  QCPLineEnding head() const { return mHead; }\n  QCPLineEnding tail() const { return mTail; }\n  \n  // setters;\n  void setPen(const QPen &pen);\n  void setSelectedPen(const QPen &pen);\n  void setHead(const QCPLineEnding &head);\n  void setTail(const QCPLineEnding &tail);\n  \n  // reimplemented virtual methods:\n  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;\n  \n  QCPItemPosition * const start;\n  QCPItemPosition * const end;\n  \nprotected:\n  // property members:\n  QPen mPen, mSelectedPen;\n  QCPLineEnding mHead, mTail;\n  \n  // reimplemented virtual methods:\n  virtual void draw(QCPPainter *painter);\n  \n  // non-virtual methods:\n  QLineF getRectClippedLine(const QVector2D &start, const QVector2D &end, const QRect &rect) const;\n  QPen mainPen() const;\n};\n\n\nclass QCP_LIB_DECL QCPItemCurve : public QCPAbstractItem\n{\n  Q_OBJECT\n  /// \\cond INCLUDE_QPROPERTIES\n  Q_PROPERTY(QPen pen READ pen WRITE setPen)\n  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)\n  Q_PROPERTY(QCPLineEnding head READ head WRITE setHead)\n  Q_PROPERTY(QCPLineEnding tail READ tail WRITE setTail)\n  /// \\endcond\npublic:\n  QCPItemCurve(QCustomPlot *parentPlot);\n  virtual ~QCPItemCurve();\n  \n  // getters:\n  QPen pen() const { return mPen; }\n  QPen selectedPen() const { return mSelectedPen; }\n  QCPLineEnding head() const { return mHead; }\n  QCPLineEnding tail() const { return mTail; }\n  \n  // setters;\n  void setPen(const QPen &pen);\n  void setSelectedPen(const QPen &pen);\n  void setHead(const QCPLineEnding &head);\n  void setTail(const QCPLineEnding &tail);\n  \n  // reimplemented virtual methods:\n  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;\n  \n  QCPItemPosition * const start;\n  QCPItemPosition * const startDir;\n  QCPItemPosition * const endDir;\n  QCPItemPosition * const end;\n  \nprotected:\n  // property members:\n  QPen mPen, mSelectedPen;\n  QCPLineEnding mHead, mTail;\n  \n  // reimplemented virtual methods:\n  virtual void draw(QCPPainter *painter);\n  \n  // non-virtual methods:\n  QPen mainPen() const;\n};\n\n\nclass QCP_LIB_DECL QCPItemRect : public QCPAbstractItem\n{\n  Q_OBJECT\n  /// \\cond INCLUDE_QPROPERTIES\n  Q_PROPERTY(QPen pen READ pen WRITE setPen)\n  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)\n  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)\n  Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)\n  /// \\endcond\npublic:\n  QCPItemRect(QCustomPlot *parentPlot);\n  virtual ~QCPItemRect();\n  \n  // getters:\n  QPen pen() const { return mPen; }\n  QPen selectedPen() const { return mSelectedPen; }\n  QBrush brush() const { return mBrush; }\n  QBrush selectedBrush() const { return mSelectedBrush; }\n  \n  // setters;\n  void setPen(const QPen &pen);\n  void setSelectedPen(const QPen &pen);\n  void setBrush(const QBrush &brush);\n  void setSelectedBrush(const QBrush &brush);\n  \n  // reimplemented virtual methods:\n  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;\n  \n  QCPItemPosition * const topLeft;\n  QCPItemPosition * const bottomRight;\n  QCPItemAnchor * const top;\n  QCPItemAnchor * const topRight;\n  QCPItemAnchor * const right;\n  QCPItemAnchor * const bottom;\n  QCPItemAnchor * const bottomLeft;\n  QCPItemAnchor * const left;\n  \nprotected:\n  enum AnchorIndex {aiTop, aiTopRight, aiRight, aiBottom, aiBottomLeft, aiLeft};\n  \n  // property members:\n  QPen mPen, mSelectedPen;\n  QBrush mBrush, mSelectedBrush;\n  \n  // reimplemented virtual methods:\n  virtual void draw(QCPPainter *painter);\n  virtual QPointF anchorPixelPoint(int anchorId) const;\n  \n  // non-virtual methods:\n  QPen mainPen() const;\n  QBrush mainBrush() const;\n};\n\n\nclass QCP_LIB_DECL QCPItemText : public QCPAbstractItem\n{\n  Q_OBJECT\n  /// \\cond INCLUDE_QPROPERTIES\n  Q_PROPERTY(QColor color READ color WRITE setColor)\n  Q_PROPERTY(QColor selectedColor READ selectedColor WRITE setSelectedColor)\n  Q_PROPERTY(QPen pen READ pen WRITE setPen)\n  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)\n  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)\n  Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)\n  Q_PROPERTY(QFont font READ font WRITE setFont)\n  Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont)\n  Q_PROPERTY(QString text READ text WRITE setText)\n  Q_PROPERTY(Qt::Alignment positionAlignment READ positionAlignment WRITE setPositionAlignment)\n  Q_PROPERTY(Qt::Alignment textAlignment READ textAlignment WRITE setTextAlignment)\n  Q_PROPERTY(double rotation READ rotation WRITE setRotation)\n  Q_PROPERTY(QMargins padding READ padding WRITE setPadding)\n  /// \\endcond\npublic:\n  QCPItemText(QCustomPlot *parentPlot);\n  virtual ~QCPItemText();\n  \n  // getters:\n  QColor color() const { return mColor; }\n  QColor selectedColor() const { return mSelectedColor; }\n  QPen pen() const { return mPen; }\n  QPen selectedPen() const { return mSelectedPen; }\n  QBrush brush() const { return mBrush; }\n  QBrush selectedBrush() const { return mSelectedBrush; }\n  QFont font() const { return mFont; }\n  QFont selectedFont() const { return mSelectedFont; }\n  QString text() const { return mText; }\n  Qt::Alignment positionAlignment() const { return mPositionAlignment; }\n  Qt::Alignment textAlignment() const { return mTextAlignment; }\n  double rotation() const { return mRotation; }\n  QMargins padding() const { return mPadding; }\n  \n  // setters;\n  void setColor(const QColor &color);\n  void setSelectedColor(const QColor &color);\n  void setPen(const QPen &pen);\n  void setSelectedPen(const QPen &pen);\n  void setBrush(const QBrush &brush);\n  void setSelectedBrush(const QBrush &brush);\n  void setFont(const QFont &font);\n  void setSelectedFont(const QFont &font);\n  void setText(const QString &text);\n  void setPositionAlignment(Qt::Alignment alignment);\n  void setTextAlignment(Qt::Alignment alignment);\n  void setRotation(double degrees);\n  void setPadding(const QMargins &padding);\n  \n  // reimplemented virtual methods:\n  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;\n  \n  QCPItemPosition * const position;\n  QCPItemAnchor * const topLeft;\n  QCPItemAnchor * const top;\n  QCPItemAnchor * const topRight;\n  QCPItemAnchor * const right;\n  QCPItemAnchor * const bottomRight;\n  QCPItemAnchor * const bottom;\n  QCPItemAnchor * const bottomLeft;\n  QCPItemAnchor * const left;\n  \nprotected:\n  enum AnchorIndex {aiTopLeft, aiTop, aiTopRight, aiRight, aiBottomRight, aiBottom, aiBottomLeft, aiLeft};\n  \n  // property members:\n  QColor mColor, mSelectedColor;\n  QPen mPen, mSelectedPen;\n  QBrush mBrush, mSelectedBrush;\n  QFont mFont, mSelectedFont;\n  QString mText;\n  Qt::Alignment mPositionAlignment;\n  Qt::Alignment mTextAlignment;\n  double mRotation;\n  QMargins mPadding;\n  \n  // reimplemented virtual methods:\n  virtual void draw(QCPPainter *painter);\n  virtual QPointF anchorPixelPoint(int anchorId) const;\n  \n  // non-virtual methods:\n  QPointF getTextDrawPoint(const QPointF &pos, const QRectF &rect, Qt::Alignment positionAlignment) const;\n  QFont mainFont() const;\n  QColor mainColor() const;\n  QPen mainPen() const;\n  QBrush mainBrush() const;\n};\n\n\nclass QCP_LIB_DECL QCPItemEllipse : public QCPAbstractItem\n{\n  Q_OBJECT\n  /// \\cond INCLUDE_QPROPERTIES\n  Q_PROPERTY(QPen pen READ pen WRITE setPen)\n  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)\n  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)\n  Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)\n  /// \\endcond\npublic:\n  QCPItemEllipse(QCustomPlot *parentPlot);\n  virtual ~QCPItemEllipse();\n  \n  // getters:\n  QPen pen() const { return mPen; }\n  QPen selectedPen() const { return mSelectedPen; }\n  QBrush brush() const { return mBrush; }\n  QBrush selectedBrush() const { return mSelectedBrush; }\n  \n  // setters;\n  void setPen(const QPen &pen);\n  void setSelectedPen(const QPen &pen);\n  void setBrush(const QBrush &brush);\n  void setSelectedBrush(const QBrush &brush);\n  \n  // reimplemented virtual methods:\n  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;\n  \n  QCPItemPosition * const topLeft;\n  QCPItemPosition * const bottomRight;\n  QCPItemAnchor * const topLeftRim;\n  QCPItemAnchor * const top;\n  QCPItemAnchor * const topRightRim;\n  QCPItemAnchor * const right;\n  QCPItemAnchor * const bottomRightRim;\n  QCPItemAnchor * const bottom;\n  QCPItemAnchor * const bottomLeftRim;\n  QCPItemAnchor * const left;\n  QCPItemAnchor * const center;\n  \nprotected:\n  enum AnchorIndex {aiTopLeftRim, aiTop, aiTopRightRim, aiRight, aiBottomRightRim, aiBottom, aiBottomLeftRim, aiLeft, aiCenter};\n  \n  // property members:\n  QPen mPen, mSelectedPen;\n  QBrush mBrush, mSelectedBrush;\n  \n  // reimplemented virtual methods:\n  virtual void draw(QCPPainter *painter);\n  virtual QPointF anchorPixelPoint(int anchorId) const;\n  \n  // non-virtual methods:\n  QPen mainPen() const;\n  QBrush mainBrush() const;\n};\n\n\nclass QCP_LIB_DECL QCPItemPixmap : public QCPAbstractItem\n{\n  Q_OBJECT\n  /// \\cond INCLUDE_QPROPERTIES\n  Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap)\n  Q_PROPERTY(bool scaled READ scaled WRITE setScaled)\n  Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode)\n  Q_PROPERTY(QPen pen READ pen WRITE setPen)\n  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)\n  /// \\endcond\npublic:\n  QCPItemPixmap(QCustomPlot *parentPlot);\n  virtual ~QCPItemPixmap();\n  \n  // getters:\n  QPixmap pixmap() const { return mPixmap; }\n  bool scaled() const { return mScaled; }\n  Qt::AspectRatioMode aspectRatioMode() const { return mAspectRatioMode; }\n  QPen pen() const { return mPen; }\n  QPen selectedPen() const { return mSelectedPen; }\n  \n  // setters;\n  void setPixmap(const QPixmap &pixmap);\n  void setScaled(bool scaled, Qt::AspectRatioMode aspectRatioMode=Qt::KeepAspectRatio);\n  void setPen(const QPen &pen);\n  void setSelectedPen(const QPen &pen);\n  \n  // reimplemented virtual methods:\n  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;\n  \n  QCPItemPosition * const topLeft;\n  QCPItemPosition * const bottomRight;\n  QCPItemAnchor * const top;\n  QCPItemAnchor * const topRight;\n  QCPItemAnchor * const right;\n  QCPItemAnchor * const bottom;\n  QCPItemAnchor * const bottomLeft;\n  QCPItemAnchor * const left;\n  \nprotected:\n  enum AnchorIndex {aiTop, aiTopRight, aiRight, aiBottom, aiBottomLeft, aiLeft};\n  \n  // property members:\n  QPixmap mPixmap;\n  QPixmap mScaledPixmap;\n  bool mScaled;\n  Qt::AspectRatioMode mAspectRatioMode;\n  QPen mPen, mSelectedPen;\n  \n  // reimplemented virtual methods:\n  virtual void draw(QCPPainter *painter);\n  virtual QPointF anchorPixelPoint(int anchorId) const;\n  \n  // non-virtual methods:\n  void updateScaledPixmap(QRect finalRect=QRect(), bool flipHorz=false, bool flipVert=false);\n  QRect getFinalRect(bool *flippedHorz=0, bool *flippedVert=0) const;\n  QPen mainPen() const;\n};\n\n\nclass QCP_LIB_DECL QCPItemTracer : public QCPAbstractItem\n{\n  Q_OBJECT\n  /// \\cond INCLUDE_QPROPERTIES\n  Q_PROPERTY(QPen pen READ pen WRITE setPen)\n  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)\n  Q_PROPERTY(QBrush brush READ brush WRITE setBrush)\n  Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush)\n  Q_PROPERTY(double size READ size WRITE setSize)\n  Q_PROPERTY(TracerStyle style READ style WRITE setStyle)\n  Q_PROPERTY(QCPGraph* graph READ graph WRITE setGraph)\n  Q_PROPERTY(double graphKey READ graphKey WRITE setGraphKey)\n  Q_PROPERTY(bool interpolating READ interpolating WRITE setInterpolating)\n  /// \\endcond\npublic:\n  /*!\n    The different visual appearances a tracer item can have. Some styles size may be controlled with \\ref setSize.\n    \n    \\see setStyle\n  */\n  enum TracerStyle { tsNone        ///< The tracer is not visible\n                     ,tsPlus       ///< A plus shaped crosshair with limited size\n                     ,tsCrosshair  ///< A plus shaped crosshair which spans the complete axis rect\n                     ,tsCircle     ///< A circle\n                     ,tsSquare     ///< A square\n                   };\n  Q_ENUMS(TracerStyle)\n\n  QCPItemTracer(QCustomPlot *parentPlot);\n  virtual ~QCPItemTracer();\n\n  // getters:\n  QPen pen() const { return mPen; }\n  QPen selectedPen() const { return mSelectedPen; }\n  QBrush brush() const { return mBrush; }\n  QBrush selectedBrush() const { return mSelectedBrush; }\n  double size() const { return mSize; }\n  TracerStyle style() const { return mStyle; }\n  QCPGraph *graph() const { return mGraph; }\n  double graphKey() const { return mGraphKey; }\n  bool interpolating() const { return mInterpolating; }\n\n  // setters;\n  void setPen(const QPen &pen);\n  void setSelectedPen(const QPen &pen);\n  void setBrush(const QBrush &brush);\n  void setSelectedBrush(const QBrush &brush);\n  void setSize(double size);\n  void setStyle(TracerStyle style);\n  void setGraph(QCPGraph *graph);\n  void setGraphKey(double key);\n  void setInterpolating(bool enabled);\n\n  // reimplemented virtual methods:\n  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;\n  \n  // non-virtual methods:\n  void updatePosition();\n\n  QCPItemPosition * const position;\n\nprotected:\n  // property members:\n  QPen mPen, mSelectedPen;\n  QBrush mBrush, mSelectedBrush;\n  double mSize;\n  TracerStyle mStyle;\n  QCPGraph *mGraph;\n  double mGraphKey;\n  bool mInterpolating;\n\n  // reimplemented virtual methods:\n  virtual void draw(QCPPainter *painter);\n\n  // non-virtual methods:\n  QPen mainPen() const;\n  QBrush mainBrush() const;\n};\n\n\nclass QCP_LIB_DECL QCPItemBracket : public QCPAbstractItem\n{\n  Q_OBJECT\n  /// \\cond INCLUDE_QPROPERTIES\n  Q_PROPERTY(QPen pen READ pen WRITE setPen)\n  Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen)\n  Q_PROPERTY(double length READ length WRITE setLength)\n  Q_PROPERTY(BracketStyle style READ style WRITE setStyle)\n  /// \\endcond\npublic:\n  enum BracketStyle { bsSquare  ///< A brace with angled edges\n                      ,bsRound  ///< A brace with round edges\n                      ,bsCurly  ///< A curly brace\n                      ,bsCalligraphic ///< A curly brace with varying stroke width giving a calligraphic impression\n  };\n\n  QCPItemBracket(QCustomPlot *parentPlot);\n  virtual ~QCPItemBracket();\n  \n  // getters:\n  QPen pen() const { return mPen; }\n  QPen selectedPen() const { return mSelectedPen; }\n  double length() const { return mLength; }\n  BracketStyle style() const { return mStyle; }\n  \n  // setters;\n  void setPen(const QPen &pen);\n  void setSelectedPen(const QPen &pen);\n  void setLength(double length);\n  void setStyle(BracketStyle style);\n  \n  // reimplemented virtual methods:\n  virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const;\n  \n  QCPItemPosition * const left;\n  QCPItemPosition * const right;\n  QCPItemAnchor * const center;\n  \nprotected:\n  // property members:\n  enum AnchorIndex {aiCenter};\n  QPen mPen, mSelectedPen;\n  double mLength;\n  BracketStyle mStyle;\n  \n  // reimplemented virtual methods:\n  virtual void draw(QCPPainter *painter);\n  virtual QPointF anchorPixelPoint(int anchorId) const;\n  \n  // non-virtual methods:\n  QPen mainPen() const;\n};\n\n#endif // QCUSTOMPLOT_H\n\n"
  },
  {
    "path": "DynamicAudioNormalizerGUI/src/Main.cpp",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Utility\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program.  If not, see <http://www.gnu.org/licenses/>.\n//\n// http://www.gnu.org/licenses/gpl-3.0.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n//Std\n#include <cstdlib>\n#include <cfloat>\n\n//Qt\n#include <QApplication>\n#include <QMainWindow>\n#include <QFileDialog>\n#include <QMessageBox>\n#include <QTextStream>\n#include <QTabWidget>\n#include <QLabel>\n#include <QStatusBar>\n#include <QPlastiqueStyle>\n#include <QRegExp>\n\n//MDynamicAudioNormalizer API\n#include \"DynamicAudioNormalizer.h\"\n\n//Internal\n#include \"3rd_party/qcustomplot.h\"\n\n//Const\nstatic const int PRE_ALLOC_SIZE = 12000;\nstatic const QLatin1String g_title(\"Dynamic Audio Normalizer GUI\");\n\ntypedef struct\n{\n\tQVector<double> original;\n\tQVector<double> minimal;\n\tQVector<double> smoothed;\n}\nLogFileData;\n\nstatic void makeAxisBold(QCPAxis *axis)\n{\n\tQFont font = axis->labelFont();\n\tfont.setBold(true);\n\taxis->setLabelFont(font);\n\n}\n\nstatic QString readNextLine(QTextStream &textStream)\n{\n\twhile ((!textStream.atEnd()) && (textStream.status() == QTextStream::Ok))\n\t{\n\t\tconst QString line = textStream.readLine().simplified();\n\t\tif (!line.isEmpty())\n\t\t{\n\t\t\treturn line;\n\t\t}\n\t}\n\treturn QString();\n}\n\nstatic bool parseHeader(QWidget &parent, QTextStream &textStream, quint32 &channels, const uint32_t versionMajor, const uint32_t versionMinor)\n{\n\tstatic const QLatin1String REGEX_HEADER(\"^\\\\s*DynamicAudioNormalizer\\\\s+Logfile\\\\s+v(\\\\d).(\\\\d\\\\d)-(\\\\d)\\\\s*$\");\n\tstatic const QLatin1String REGEX_CHNNLS(\"^\\\\s*CHANNEL_COUNT\\\\s*:\\\\s*(\\\\d+)\\\\s*$\");\n\n\tQRegExp header(REGEX_HEADER, Qt::CaseInsensitive);\n\tQRegExp channelCount(REGEX_CHNNLS, Qt::CaseInsensitive);\n\n\tconst QString headerLine = readNextLine(textStream);\n\tif(headerLine.isEmpty() || (header.indexIn(headerLine) < 0))\n\t{\n\t\tQMessageBox::warning(&parent, g_title, QLatin1String(\"Invalid file: Header line could not be found!\"));\n\t\treturn false;\n\t}\n\n\tbool okay[2] = { false, false };\n\tuint32_t fileVersion[2];\n\tfileVersion[0] = header.cap(1).toUInt(&okay[0]);\n\tfileVersion[1] = header.cap(2).toUInt(&okay[1]);\n\tif ((!(okay[0] && okay[1])) || (fileVersion[0] != versionMajor) || (fileVersion[1] > versionMinor))\n\t{\n\t\tQMessageBox::warning(&parent, g_title, QLatin1String(\"Invalid file: Unsupported file format version!\"));\n\t\treturn false;\n\t}\n\n\tconst QString channelLine = readNextLine(textStream);\n\tif(channelLine.isEmpty() || (channelCount.indexIn(channelLine) < 0))\n\t{\n\t\tQMessageBox::warning(&parent, g_title, QLatin1String(\"Invalid file: Number of channels could not be found!\"));\n\t\treturn false;\n\t}\n\n\tbool haveChannels = false;\n\tchannels = channelCount.cap(1).toUInt(&haveChannels);\n\tif ((!haveChannels) || (channels < 1))\n\t{\n\t\tQMessageBox::warning(&parent, g_title, QLatin1String(\"Invalid file: Number of channels is invalid!\"));\n\t\treturn false;\n\t}\n\n\treturn true; /*success*/\n}\n\nstatic bool parseLine(const quint32 channels, const QStringList &input, QVector<double> &output)\n{\n\tconst int minLength = qMin(input.count(), output.count());\n\tQVector<double>::Iterator outputIter = output.begin();\n\tQStringList::ConstIterator inputIter = input.constBegin();\n\tfor (int i = 0; i < minLength; ++i)\n\t{\n\t\tbool okay = false;\n\t\t*(outputIter++) = (inputIter++)->toDouble(&okay);\n\t\tif (!okay)\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true; /*success*/\n}\n\nstatic void parseData(QTextStream &textStream, const quint32 channels, LogFileData *data, double &minValue, double &maxValue)\n{\n\tconst QRegExp spaces(QLatin1String(\"\\\\s+\"));\n\tQVector<double> temp(channels * 3U);\n\tforever\n\t{\n\t\tconst QString line = readNextLine(textStream);\n\t\tif(!line.isEmpty())\n\t\t{\n\t\t\tconst QStringList tokens = line.split(spaces, QString::SkipEmptyParts);\n\t\t\tif ((quint32)tokens.count() >= (channels * 3U))\n\t\t\t{\n\t\t\t\tif (parseLine(channels, tokens, temp))\n\t\t\t\t{\n\t\t\t\t\tQVector<double>::ConstIterator tempIter = temp.constBegin();\n\t\t\t\t\tfor (quint32 c = 0; c < channels; c++)\n\t\t\t\t\t{\n\t\t\t\t\t\tdata[c].original.append(*(tempIter++));\n\t\t\t\t\t\tdata[c].minimal .append(*(tempIter++));\n\t\t\t\t\t\tdata[c].smoothed.append(*(tempIter++));\n\t\t\t\t\t\tminValue = qMin(qMin(minValue, data[c].original.back()), qMin(data[c].minimal.back(), data[c].smoothed.back()));\n\t\t\t\t\t\tmaxValue = qMax(qMax(maxValue, data[c].original.back()), qMax(data[c].minimal.back(), data[c].smoothed.back()));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tbreak; /*end of file*/\n\t}\n}\n\nstatic void createGraph(QCustomPlot *const plot, QVector<double> &steps, QVector<double> &data, const Qt::GlobalColor &color, const Qt::PenStyle &style, const int width)\n{\n\tQCPGraph *graph = plot->addGraph();\n\tQPen pen(color);\n\tpen.setStyle(style);\n\tpen.setWidth(width);\n\tgraph->setPen(pen);\n\tgraph->setData(steps, data);\n}\n\nstatic int dynamicNormalizerGuiMain(int argc, char* argv[])\n{\n\tuint32_t versionMajor, versionMinor, versionPatch;\n\tMDynamicAudioNormalizer::getVersionInfo(versionMajor, versionMinor, versionPatch);\n\n\tconst char *buildDate, *buildTime, *buildCompiler, *buildArch; bool buildDebug;\n\tMDynamicAudioNormalizer::getBuildInfo(&buildDate, &buildTime, &buildCompiler, &buildArch, buildDebug);\n\n\t//initialize application\n\tQApplication app(argc, argv);\n\tapp.setWindowIcon(QIcon(QLatin1String(\":/res/chart_curve.png\")));\n\tapp.setStyle(new QPlastiqueStyle());\n\tapp.setStyleSheet(QLatin1String(\"QStatusBar::item{border:none}\"));\n\n\t//create basic tab widget\n\tQMainWindow window;\n\twindow.setWindowTitle(QString::fromLatin1(\"Dynamic Audio Normalizer - Log Viewer [%1]\").arg(QString().sprintf(\"v%u.%02u-%u\", versionMajor, versionMinor, versionPatch)));\n\twindow.setMinimumSize(640, 480);\n\twindow.setContentsMargins(5, 5, 5, 5);\n\t\n\t//create statusbar widget\n\tQStatusBar statusbar;\n\tQLabel info(QString(\"Copyright (c) 2014-%1 LoRd_MuldeR <mulder2@gmx.de> | License: GNU General Public License v3\").arg(QString::fromLatin1(&buildDate[7])));\n\tstatusbar.addPermanentWidget(&info);\n\twindow.setStatusBar(&statusbar);\n\n\t//show the window\n\twindow.show();\n\n\t//get arguments\n\tconst QStringList args = app.arguments();\n\t\n\t//choose input file\n\tconst QString logFileName = (args.size() < 2) ? QFileDialog::getOpenFileName(&window, QLatin1String(\"Open Log File\"), QString(), QLatin1String(\"Log File (*.log)\")) : args.at(1);\n\tif(logFileName.isEmpty())\n\t{\n\t\treturn EXIT_FAILURE;\n\t}\n\n\t//check for existence\n\tif(!(QFileInfo(logFileName).exists() && QFileInfo(logFileName).isFile()))\n\t{\n\t\tQMessageBox::critical(&window, g_title, QLatin1String(\"Error: The specified log file could not be found!\"));\n\t\treturn EXIT_FAILURE;\n\t}\n\n\t//open the input file\n\tQFile logFile(logFileName);\n\tif(!logFile.open(QIODevice::ReadOnly | QIODevice::Text))\n\t{\n\t\tQMessageBox::critical(&window, g_title, QLatin1String(\"Error: The selected log file could not opened for reading!\"));\n\t\treturn EXIT_FAILURE;\n\t}\n\n\t//wrap into text stream\n\tQTextStream textStream(&logFile);\n\ttextStream.setCodec(\"UTF-8\");\n\n\tquint32 channels = 0;\n\tdouble minValue = DBL_MAX;\n\tdouble maxValue = 0.0;\n\n\t//parse header\n\tif(!parseHeader(window, textStream, channels, versionMajor, versionMinor))\n\t{\n\t\tQMessageBox::critical(&window, g_title, QLatin1String(\"Error: Failed to parse the header of the selected log file!\\nProbably this file is corrupted or an unsupported type.\"));\n\t\treturn EXIT_FAILURE;\n\t}\n\n\t//allocate buffers\n\tQVector<LogFileData> data(channels);\n\tfor (quint32 c = 0; c < channels; c++)\n\t{\n\t\tdata[c].original.reserve(PRE_ALLOC_SIZE);\n\t\tdata[c].minimal .reserve(PRE_ALLOC_SIZE);\n\t\tdata[c].smoothed.reserve(PRE_ALLOC_SIZE);\n\t}\n\n\t//load data\n\tparseData(textStream, channels, data.data(), minValue, maxValue);\n\tlogFile.close();\n\n\t//check data\n\tif((data[0].original.size() < 1) || (data[0].minimal.size() < 1) || (data[0].smoothed.size() < 1))\n\t{\n\t\tQMessageBox::critical(&window, g_title, QLatin1String(\"Error: Failed to load data from log file.\\nFile countains no valid data points!\"));\n\t\treturn EXIT_FAILURE;\n\t}\n\n\t//determine length of data\n\tquint32 length = UINT_MAX;\n\tfor(quint32 c = 0; c < channels; c++)\n\t{\n\t\tlength = qMin(length, (quint32)data[c].original.count());\n\t\tlength = qMin(length, (quint32)data[c].minimal .count());\n\t\tlength = qMin(length, (quint32)data[c].smoothed.count());\n\t}\n\n\t//create x-axis steps\n\tQVector<double> steps(length);\n\tfor(quint32 i = 0; i < length; i++)\n\t{\n\t\tsteps[i] = double(i);\n\t}\n\n\t//Create tab widget\n\tQTabWidget tabWidget(&window);\n\twindow.setCentralWidget(&tabWidget);\n\n\t//now create the plots\n\tQVector<QCustomPlot*> plot(channels, NULL);\n\tfor(quint32 c = 0; c < channels; c++)\n\t{\n\t\t//create new instance\n\t\tplot[c] = new QCustomPlot(&window);\n\n\t\t//init the legend\n\t\tplot[c]->legend->setVisible(true);\n\t\tplot[c]->legend->setFont(QFont(QLatin1String(\"Helvetica\"), 9));\n\n\t\t//create graph and assign data to it:\n\t\tcreateGraph(plot[c], steps, data[c].original, Qt::blue,  Qt::SolidLine, 1);\n\t\tcreateGraph(plot[c], steps, data[c].minimal,  Qt::green, Qt::SolidLine, 1);\n\t\tcreateGraph(plot[c], steps, data[c].smoothed, Qt::red,   Qt::DashLine,  2);\n\n\t\t//set plot names\n\t\tplot[c]->graph(0)->setName(QLatin1String(\"Local Max. Gain\"));\n\t\tplot[c]->graph(1)->setName(QLatin1String(\"Minimum Filtered\"));\n\t\tplot[c]->graph(2)->setName(QLatin1String(\"Final Smoothed\"));\n\n\t\t//set axes labels:\n\t\tplot[c]->xAxis->setLabel(QLatin1String(\"Frame #\"));\n\t\tplot[c]->yAxis->setLabel(QLatin1String(\"Gain Factor\"));\n\t\tmakeAxisBold(plot[c]->xAxis);\n\t\tmakeAxisBold(plot[c]->yAxis);\n\n\t\t//set axes ranges\n\t\tplot[c]->xAxis->setRange(0.0, length);\n\t\tplot[c]->yAxis->setRange(minValue - 0.25, maxValue + 0.25);\n\t\tplot[c]->yAxis->setScaleType(QCPAxis::stLinear);\n\t\tplot[c]->yAxis->setTickStep(1.0);\n\t\tplot[c]->yAxis->setAutoTickStep(false);\n\n\t\t//add title\n\t\tplot[c]->plotLayout()->insertRow(0);\n\t\tplot[c]->plotLayout()->addElement(0, 0, new QCPPlotTitle(plot[c], QString::fromLatin1(\"%1 (Channel %2/%3)\").arg(QFileInfo(logFile).fileName(), QString::number(c+1), QString::number(channels))));\n\n\t\t//show the plot\n\t\tplot[c]->replot();\n\t\ttabWidget.addTab(plot[c], QString().sprintf(\"Channel #%u\", c + 1));\n\t}\n\n\t//run application\n\twindow.showMaximized();\n\tapp.exec();\n\n\t//clean-up\n\tfor (QVector<QCustomPlot*>::Iterator iter = plot.begin(); iter != plot.end(); ++iter)\n\t{\n\t\tif (*iter)\n\t\t{\n\t\t\tdelete *iter;\n\t\t\t*iter = NULL;\n\t\t}\n\t}\n\n\treturn EXIT_SUCCESS;\n}\n\nint main(int argc, char* argv[])\n{\n\tint exitCode = EXIT_SUCCESS;\n\n\ttry\n\t{\n\t\texitCode = dynamicNormalizerGuiMain(argc, argv);\n\t}\n\tcatch(std::exception &e)\n\t{\n\t\tfprintf(stderr, \"\\n\\nGURU MEDITATION: Unhandeled C++ exception error: %s\\n\\n\", e.what());\n\t\texitCode = EXIT_FAILURE;\n\t}\n\tcatch(...)\n\t{\n\t\tfprintf(stderr, \"\\n\\nGURU MEDITATION: Unhandeled unknown C++ exception error!\\n\\n\");\n\t\texitCode = EXIT_FAILURE;\n\t}\n\n\treturn exitCode;\n}\n"
  },
  {
    "path": "DynamicAudioNormalizerGUI/src/WinMain.cpp",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Utility\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this program.  If not, see <http://www.gnu.org/licenses/>.\n//\n// http://www.gnu.org/licenses/gpl-3.0.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#ifdef _WIN32\n\n#define WIN32_LEAN_AND_MEAN\n#include <Windows.h>\n\n//===================================================================\n// WinMain entry point\n//===================================================================\n\nstatic LONG WINAPI my_exception_handler(struct _EXCEPTION_POINTERS*)\n{\n\tFatalAppExitW(0, L\"GURU MEDITATION: Unhandeled exception handler invoked, application will exit!\\n\");\n\tTerminateProcess(GetCurrentProcess(), 666);\n\treturn EXCEPTION_EXECUTE_HANDLER;\n}\n\nextern \"C\"\n{\n\tint mainCRTStartup(void);\n\n\tint win32EntryPoint(void)\n\t{\n#ifndef _DEBUG\n\t\tSetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);\n\t\tSetUnhandledExceptionFilter(my_exception_handler);\n#endif\n\t\treturn mainCRTStartup();\n\t}\n}\n\n#endif //_WIN32\n"
  },
  {
    "path": "DynamicAudioNormalizerJNI/.classpath",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<classpath>\n\t<classpathentry kind=\"src\" path=\"src\"/>\n\t<classpathentry kind=\"src\" path=\"samples\"/>\n\t<classpathentry kind=\"src\" path=\"test\"/>\n\t<classpathentry kind=\"con\" path=\"org.eclipse.jdt.launching.JRE_CONTAINER\"/>\n\t<classpathentry kind=\"con\" path=\"org.eclipse.jdt.junit.JUNIT_CONTAINER/4\"/>\n\t<classpathentry kind=\"output\" path=\"bin\"/>\n</classpath>\n"
  },
  {
    "path": "DynamicAudioNormalizerJNI/.project",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<projectDescription>\n\t<name>DynamicAudioNormalizerJNI</name>\n\t<comment></comment>\n\t<projects>\n\t</projects>\n\t<buildSpec>\n\t\t<buildCommand>\n\t\t\t<name>org.eclipse.jdt.core.javabuilder</name>\n\t\t\t<arguments>\n\t\t\t</arguments>\n\t\t</buildCommand>\n\t</buildSpec>\n\t<natures>\n\t\t<nature>org.eclipse.jdt.core.javanature</nature>\n\t</natures>\n</projectDescription>\n"
  },
  {
    "path": "DynamicAudioNormalizerJNI/build.xml",
    "content": "<project name=\"JDynamicAudioNormalizer\" default=\"deploy\">\n\t<target name=\"clean\">\n\t\t<delete dir=\"bin\"/>\n\t\t<delete dir=\"out\"/>\n\t</target>\n\t<target name=\"compile\" depends=\"clean\">\n\t\t<mkdir dir=\"bin\"/>\n\t\t<javac target=\"1.6\" source=\"1.6\" srcdir=\"src\" destdir=\"bin\" includeantruntime=\"false\" excludes=\"**/samples/**\">\n\t\t\t<compilerarg value=\"-Xlint:-options\"/>\n\t\t</javac>\n\t</target>\n\t<target name=\"deploy\" depends=\"clean,compile\" description=\"create a Jar file for the application\">\n\t\t<mkdir dir=\"out\"/>\n\t\t<delete file=\"out/DynamicAudioNormalizerJNI.jar\"/>\n\t\t<jar destfile=\"out/DynamicAudioNormalizerJNI.jar\">\n\t\t\t<fileset dir=\"bin\" includes=\"**/*.class\"/>\n\t\t\t<fileset dir=\"../\" includes=\"LICENSE-*\"/>\n\t\t\t<manifest>\n\t\t\t\t<attribute name=\"Built-By\" value=\"LoRd_MudeR &lt;mulder2@gmx.de&gt;\"/>\n\t\t\t\t<attribute name=\"Main-Class\" value=\"com.muldersoft.dynaudnorm.JDynamicAudioNormalizer\"/>\n\t\t\t</manifest>\n\t\t</jar>\n\t</target>\n</project>\n\n"
  },
  {
    "path": "DynamicAudioNormalizerJNI/generate_headers.bat",
    "content": "@echo off\n\nif not exist \"%JAVA_HOME%\\bin\\javah.exe\" (\n\techo Could not find 'javah.exe', please check your JDK_PATH environment variable!\n\tpause & exit\n)\n\necho Generating JNI headers, please stand by...\necho.\n\nmkdir \"%~dp0\\include\" 2> NUL\ndel /F /Q \"%~dp0\\include\\*.h\" 2> NUL\n\n\"%JAVA_HOME%\\bin\\javah.exe\" -d \"%~dp0\\include\" -cp \"%~dp0\\bin\" com.muldersoft.dynaudnorm.JDynamicAudioNormalizer\n\nif not \"%ERRORLEVEL%\"==\"0\" (\n\techo.\n\techo Whoops: Something went wrong !!!\n\techo.\n\tgoto TheEndMyFriend\n)\n\necho Completed.\necho.\n\n:TheEndMyFriend\npause\n"
  },
  {
    "path": "DynamicAudioNormalizerJNI/include/com_muldersoft_dynaudnorm_JDynamicAudioNormalizer.h",
    "content": "/* DO NOT EDIT THIS FILE - it is machine generated */\n#include <jni.h>\n/* Header for class com_muldersoft_dynaudnorm_JDynamicAudioNormalizer */\n\n#ifndef _Included_com_muldersoft_dynaudnorm_JDynamicAudioNormalizer\n#define _Included_com_muldersoft_dynaudnorm_JDynamicAudioNormalizer\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n#ifdef __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "DynamicAudioNormalizerJNI/include/com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_Error.h",
    "content": "/* DO NOT EDIT THIS FILE - it is machine generated */\n#include <jni.h>\n/* Header for class com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_Error */\n\n#ifndef _Included_com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_Error\n#define _Included_com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_Error\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n#undef com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_Error_serialVersionUID\n#define com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_Error_serialVersionUID -3042686055658047285i64\n#undef com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_Error_serialVersionUID\n#define com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_Error_serialVersionUID -3387516993124229948i64\n#undef com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_Error_serialVersionUID\n#define com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_Error_serialVersionUID -7034897190745766939i64\n#undef com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_Error_serialVersionUID\n#define com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_Error_serialVersionUID 8560360516304094422i64\n#ifdef __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "DynamicAudioNormalizerJNI/include/com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_Logger.h",
    "content": "/* DO NOT EDIT THIS FILE - it is machine generated */\n#include <jni.h>\n/* Header for class com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_Logger */\n\n#ifndef _Included_com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_Logger\n#define _Included_com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_Logger\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n#ifdef __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "DynamicAudioNormalizerJNI/include/com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_NativeAPI_r8.h",
    "content": "/* DO NOT EDIT THIS FILE - it is machine generated */\n#include <jni.h>\n/* Header for class com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_NativeAPI_r8 */\n\n#ifndef _Included_com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_NativeAPI_r8\n#define _Included_com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_NativeAPI_r8\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n/*\n * Class:     com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_NativeAPI_r8\n * Method:    getVersionInfo\n * Signature: ([I)Z\n */\nJNIEXPORT jboolean JNICALL Java_com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_00024NativeAPI_1r8_getVersionInfo\n  (JNIEnv *, jobject, jintArray);\n\n/*\n * Class:     com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_NativeAPI_r8\n * Method:    getBuildInfo\n * Signature: (Ljava/util/Map;)Z\n */\nJNIEXPORT jboolean JNICALL Java_com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_00024NativeAPI_1r8_getBuildInfo\n  (JNIEnv *, jobject, jobject);\n\n/*\n * Class:     com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_NativeAPI_r8\n * Method:    setLoggingHandler\n * Signature: (Lcom/muldersoft/dynaudnorm/JDynamicAudioNormalizer/Logger;)Z\n */\nJNIEXPORT jboolean JNICALL Java_com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_00024NativeAPI_1r8_setLoggingHandler\n  (JNIEnv *, jobject, jobject);\n\n/*\n * Class:     com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_NativeAPI_r8\n * Method:    createInstance\n * Signature: (IIIIDDDDZZZ)I\n */\nJNIEXPORT jint JNICALL Java_com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_00024NativeAPI_1r8_createInstance\n  (JNIEnv *, jobject, jint, jint, jint, jint, jdouble, jdouble, jdouble, jdouble, jboolean, jboolean, jboolean);\n\n/*\n * Class:     com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_NativeAPI_r8\n * Method:    destroyInstance\n * Signature: (I)Z\n */\nJNIEXPORT jboolean JNICALL Java_com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_00024NativeAPI_1r8_destroyInstance\n  (JNIEnv *, jobject, jint);\n\n/*\n * Class:     com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_NativeAPI_r8\n * Method:    process\n * Signature: (I[[D[[DJ)J\n */\nJNIEXPORT jlong JNICALL Java_com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_00024NativeAPI_1r8_process\n  (JNIEnv *, jobject, jint, jobjectArray, jobjectArray, jlong);\n\n/*\n * Class:     com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_NativeAPI_r8\n * Method:    processInplace\n * Signature: (I[[DJ)J\n */\nJNIEXPORT jlong JNICALL Java_com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_00024NativeAPI_1r8_processInplace\n  (JNIEnv *, jobject, jint, jobjectArray, jlong);\n\n/*\n * Class:     com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_NativeAPI_r8\n * Method:    flushBuffer\n * Signature: (I[[D)J\n */\nJNIEXPORT jlong JNICALL Java_com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_00024NativeAPI_1r8_flushBuffer\n  (JNIEnv *, jobject, jint, jobjectArray);\n\n/*\n * Class:     com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_NativeAPI_r8\n * Method:    reset\n * Signature: (I)Z\n */\nJNIEXPORT jboolean JNICALL Java_com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_00024NativeAPI_1r8_reset\n  (JNIEnv *, jobject, jint);\n\n/*\n * Class:     com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_NativeAPI_r8\n * Method:    getConfiguration\n * Signature: (ILjava/util/Map;)Z\n */\nJNIEXPORT jboolean JNICALL Java_com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_00024NativeAPI_1r8_getConfiguration\n  (JNIEnv *, jobject, jint, jobject);\n\n/*\n * Class:     com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_NativeAPI_r8\n * Method:    getInternalDelay\n * Signature: (I)J\n */\nJNIEXPORT jlong JNICALL Java_com_muldersoft_dynaudnorm_JDynamicAudioNormalizer_00024NativeAPI_1r8_getInternalDelay\n  (JNIEnv *, jobject, jint);\n\n#ifdef __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "DynamicAudioNormalizerJNI/makefile",
    "content": "##############################################################################\n# Dynamic Audio Normalizer - Audio Processing Library\n# Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n#\n# This library is free software; you can redistribute it and/or\n# modify it under the terms of the GNU Lesser General Public\n# License as published by the Free Software Foundation; either\n# version 2.1 of the License, or (at your option) any later version.\n#\n# This library is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n# Lesser General Public License for more details.\n#\n# You should have received a copy of the GNU Lesser General Public\n# License along with this library; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n#\n# http://www.gnu.org/licenses/lgpl-2.1.txt\n##############################################################################\n\nECHO=echo -e\nSHELL=/bin/bash\n\nANT ?= ant\n\n##############################################################################\n# Ant Checks\n##############################################################################\n\nifneq ($(MAKECMDGOALS),clean)\n   ANT_CHECK = $(findstring Apache Ant,$(shell $(ANT) -version 2>&1))\n   ifneq ($(ANT_CHECK),Apache Ant)\n      $(error Apache Ant not found. Please set ANT environment variable properly!)\n   endif\nendif\n\n##############################################################################\n# Rules\n##############################################################################\n\nSOURCES_CPP = $(wildcard src/*.cpp)\nSOURCES_OBJ = $(patsubst %.cpp,%.o,$(SOURCES_CPP))\n\nLIBRARY_OUT = lib/$(LIBRARY_NAME)-$(API_VERSION)\nLIBRARY_BIN = $(LIBRARY_OUT).so\nLIBRARY_DBG = $(LIBRARY_OUT)-DBG.so\n\n##############################################################################\n# Rules\n##############################################################################\n\n.PHONY: all clean\n\n#-------------------------------------------------------------\n# Compile\n#-------------------------------------------------------------\n\nall: build.xml\n\t@$(ECHO) \"\\e[1;36m[ANT] $<\\e[0m\"\n\t$(ANT) -buildfile $<\n\n#-------------------------------------------------------------\n# Clean\n#-------------------------------------------------------------\n\nclean: build.xml\n\t@$(ECHO) \"\\e[1;36m[ANT] $< clean\\e[0m\"\n\t$(ANT) -buildfile $< clean || echo \"Ant clean failed!\"\n\trm -rfv ./bin\n\trm -rfv ./out\n\n"
  },
  {
    "path": "DynamicAudioNormalizerJNI/samples/com/muldersoft/dynaudnorm/samples/AudioFileIO.java",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Java/JNI Wrapper\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n// http://opensource.org/licenses/MIT\n//////////////////////////////////////////////////////////////////////////////////\n\npackage com.muldersoft.dynaudnorm.samples;\n\nimport java.io.BufferedInputStream;\nimport java.io.BufferedOutputStream;\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.nio.ByteBuffer;\nimport java.nio.ByteOrder;\n\npublic class AudioFileIO {\n\n\tpublic enum PCMFileType\n\t{\n\t\tPCM_16BIT_LE,\n\t\tPCM_16BIT_BE,\n\t\tPCM_32BIT_LE,\n\t\tPCM_32BIT_BE,\n\t\tPCM_64BIT_LE,\n\t\tPCM_64BIT_BE,\n\t}\n\t\n\tprivate static class PCMFileBase {\n\t\tprotected static ByteOrder getEndianess(final PCMFileType type) {\n\t\t\tswitch(type) {\n\t\t\tcase PCM_16BIT_LE:\n\t\t\tcase PCM_32BIT_LE:\n\t\t\tcase PCM_64BIT_LE:\n\t\t\t\treturn ByteOrder.LITTLE_ENDIAN;\n\t\t\tcase PCM_32BIT_BE:\n\t\t\tcase PCM_16BIT_BE:\n\t\t\tcase PCM_64BIT_BE:\n\t\t\t\treturn ByteOrder.BIG_ENDIAN;\n\t\t\tdefault:\n\t\t\t\tthrow new IllegalArgumentException();\n\t\t\t}\n\t\t}\n\t\t\n\t\tprotected static int getSampleSize(final PCMFileType type) {\n\t\t\tswitch(type) {\n\t\t\tcase PCM_16BIT_LE:\n\t\t\tcase PCM_16BIT_BE:\n\t\t\t\treturn 2;\n\t\t\tcase PCM_32BIT_LE:\n\t\t\tcase PCM_32BIT_BE:\n\t\t\t\treturn 4;\n\t\t\tcase PCM_64BIT_LE:\n\t\t\tcase PCM_64BIT_BE:\n\t\t\t\treturn 8;\n\t\t\tdefault:\n\t\t\t\tthrow new IllegalArgumentException();\n\t\t\t}\n\t\t}\n\t\t\n\t\tprotected static double readSample(final PCMFileType type, final ByteBuffer input) {\n\t\t\tswitch(type) {\n\t\t\tcase PCM_16BIT_LE:\n\t\t\tcase PCM_16BIT_BE:\n\t\t\t\treturn ShortToDouble(input.getShort());\n\t\t\tcase PCM_32BIT_LE:\n\t\t\tcase PCM_32BIT_BE:\n\t\t\t\treturn input.getFloat();\n\t\t\tcase PCM_64BIT_LE:\n\t\t\tcase PCM_64BIT_BE:\n\t\t\t\treturn input.getDouble();\n\t\t\tdefault:\n\t\t\t\tthrow new IllegalArgumentException();\n\t\t\t}\n\t\t}\n\t\t\n\t\tprotected static ByteBuffer writeSample(final PCMFileType type, final ByteBuffer output, final double value) {\n\t\t\tswitch(type) {\n\t\t\tcase PCM_16BIT_LE:\n\t\t\tcase PCM_16BIT_BE:\n\t\t\t\treturn output.putShort(doubleToShort(value));\n\t\t\tcase PCM_32BIT_LE:\n\t\t\tcase PCM_32BIT_BE:\n\t\t\t\treturn output.putFloat((float)value);\n\t\t\tcase PCM_64BIT_LE:\n\t\t\tcase PCM_64BIT_BE:\n\t\t\t\treturn output.putDouble(value);\n\t\t\tdefault:\n\t\t\t\tthrow new IllegalArgumentException();\n\t\t\t}\n\t\t}\n\t\t\n\t\tprivate static double ShortToDouble(final short val) {\n\t\t\treturn ((double) val) / ((double) Short.MAX_VALUE);\n\t\t}\n\t\t\n\t\tprivate static short doubleToShort(final double val) {\n\t\t\treturn (short) Math.round(Math.max(-1.0, Math.min(1.0, val)) * ((double) Short.MAX_VALUE));\n\t\t}\n\t}\n\t\n\tpublic static class PCMFileReader extends PCMFileBase implements AutoCloseable {\n\t\tprivate final PCMFileType type;\n\t\tprivate final int channels;\n\t\tprivate final BufferedInputStream inputStream;\n\t\tprivate byte[] tempBuffer = null;\n\n\t\tpublic PCMFileReader(final String fileName, final int channels, final PCMFileType type) throws IOException {\n\t\t\tif((channels < 1) || (channels > 8)) {\n\t\t\t\tthrow new IllegalArgumentException(\"Invalid number of channels!\");\n\t\t\t}\n\t\t\tthis.type = type;\n\t\t\tthis.channels = channels;\n\t\t\tinputStream = new BufferedInputStream(new FileInputStream(new File(fileName)));\n\t\t}\n\n\t\tpublic int read(double[][] buffer) throws IOException {\n\t\t\tif (buffer.length < channels) {\n\t\t\t\tthrow new RuntimeException(\"Output array dimension must match channels!\");\n\t\t\t}\n\t\t\t\n\t\t\tint buffSize = Integer.MAX_VALUE;\n\t\t\tfor(int c = 0; c < channels; c++) {\n\t\t\t\tif((buffSize = Math.min(buffSize, buffer[c].length)) < 1) {\n\t\t\t\t\tthrow new RuntimeException(\"Output array length must be at least one!\");\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tfinal int frameSize = getSampleSize(type) * channels;\n\t\t\tfinal int maxReadSize = buffSize * frameSize;\n\t\t\tif ((tempBuffer == null) || (tempBuffer.length < maxReadSize)) {\n\t\t\t\ttempBuffer = new byte[maxReadSize];\n\t\t\t}\n\n\t\t\tfinal int byteCount = inputStream.read(tempBuffer, 0, maxReadSize);\n\t\t\tif((byteCount % frameSize) != 0) {\n\t\t\t\tthrow new RuntimeException(\"Number of bytes is not a multiple of frame size!\");\n\t\t\t}\n\t\t\t\n\t\t\tfinal int sampleCount = byteCount / frameSize;\n\t\t\tif (sampleCount > 0) {\n\t\t\t\tByteBuffer byteBuffer = ByteBuffer.wrap(tempBuffer);\n\t\t\t\tbyteBuffer.order(getEndianess(type));\n\t\t\t\tfor (int i = 0; i < sampleCount; i++) {\n\t\t\t\t\tfor (int c = 0; c < channels; c++) {\n\t\t\t\t\t\tbuffer[c][i] = readSample(type, byteBuffer);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn sampleCount;\n\t\t}\n\n\t\tpublic void close() throws IOException {\n\t\t\tinputStream.close();\n\t\t}\n\t}\n\n\t// ------------------------------------------------------------------------------------------------\n\t// PCM File Writer\n\t// ------------------------------------------------------------------------------------------------\n\n\tpublic static class PCMFileWriter extends PCMFileBase implements AutoCloseable {\n\t\tprivate final PCMFileType type;\n\t\tprivate final int channels;\n\t\tprivate final BufferedOutputStream outputStream;\n\t\tprivate byte[] tempBuffer = null;\n\n\t\tpublic PCMFileWriter(final String fileName, final int channels, final PCMFileType type) throws IOException {\n\t\t\tif((channels < 1) || (channels > 8)) {\n\t\t\t\tthrow new IllegalArgumentException(\"Invalid number of channels!\");\n\t\t\t}\n\t\t\tthis.type = type;\n\t\t\tthis.channels = channels;\n\t\t\toutputStream = new BufferedOutputStream(new FileOutputStream(new File(fileName)));\n\t\t}\n\n\t\tpublic void write(double[][] buffer, final int sampleCount) throws IOException {\n\t\t\tif (buffer.length < channels) {\n\t\t\t\tthrow new IOException(\"Input array dimension must match channels!\");\n\t\t\t}\n\n\t\t\tfor(int c = 0; c < channels; c++) {\n\t\t\t\tif(buffer[c].length < sampleCount) {\n\t\t\t\t\tthrow new RuntimeException(\"Input array length must be greater or equal to sampleCount!\");\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tfinal int frameSize = getSampleSize(type) * channels;\n\t\t\tfinal int writeSize = sampleCount * frameSize;\n\t\t\tif ((tempBuffer == null) || (tempBuffer.length < writeSize)) {\n\t\t\t\ttempBuffer = new byte[writeSize];\n\t\t\t}\n\n\t\t\tif (sampleCount > 0) {\n\t\t\t\tByteBuffer byteBuffer = ByteBuffer.wrap(tempBuffer);\n\t\t\t\tbyteBuffer.order(getEndianess(type));\n\t\t\t\tfor (int i = 0; i < sampleCount; i++) {\n\t\t\t\t\tfor (int c = 0; c < channels; c++) {\n\t\t\t\t\t\twriteSample(type, byteBuffer, buffer[c][i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\toutputStream.write(tempBuffer, 0, writeSize);\n\t\t}\n\n\t\tpublic void flush() throws IOException {\n\t\t\toutputStream.flush();\n\t\t}\n\n\t\tpublic void close() throws IOException {\n\t\t\tflush();\n\t\t\toutputStream.close();\n\t\t}\n\t}\n\n}\n"
  },
  {
    "path": "DynamicAudioNormalizerJNI/samples/com/muldersoft/dynaudnorm/samples/DynamicAudioNormalizerExample.java",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Java/JNI Wrapper\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n// http://opensource.org/licenses/MIT\n//////////////////////////////////////////////////////////////////////////////////\n\npackage com.muldersoft.dynaudnorm.samples;\n\nimport java.io.IOException;\nimport java.security.NoSuchAlgorithmException;\nimport java.util.Map;\n\nimport com.muldersoft.dynaudnorm.JDynamicAudioNormalizer;\n\npublic class DynamicAudioNormalizerExample {\n\n\t//Default arguments\n\tprivate static final int CHANNELS_DEFAULT = 2;\n\tprivate static final int SAMPLE_RATE_DEFAULT = 44100;\n\tprivate static final AudioFileIO.PCMFileType AUDIO_FORMAT_DEFAULT = AudioFileIO.PCMFileType.PCM_16BIT_LE;\n\t\n\t//Normalizer options\n\tprivate static final int FRAME_LEN = 500;\t//Frame length in MSec\n\tprivate static final int FILTER_SIZE = 31;\t//Filter size in frames\n\t\n\t//------------------------------------------------------------------------------------------------\n\t// Print Logo\n\t//------------------------------------------------------------------------------------------------\n\t\n\tprivate static void printLogo() {\n\t\tint [] version = null;\n\t\tMap<String,String> buildInfo = null;\n\t\ttry\t{\n\t\t\ttry\t{\n\t\t\t\tversion = JDynamicAudioNormalizer.getVersionInfo();\n\t\t\t\tbuildInfo = JDynamicAudioNormalizer.getBuildInfo();\n\t\t\t}\n\t\t\tcatch(Exception ex) {\n\t\t\t\tthrow new Error(\"Failed to initialize DynamicAudioNormalizer library!\", ex);\n\t\t\t}\n\t\t}\n\t\tfinally {\n\t\t\tSystem.out.println(\"\\n===========================================================================\");\n\t\t\tif((version != null) && (version.length >= 3)) {\n\t\t\t\tSystem.out.printf(\"Dynamic Audio Normalizer, Version %d.%02d-%d\\n\", version[0], version[1], version[2]);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.println(\"Dynamic Audio Normalizer, Unknown Version\");\n\t\t\t}\n\t\t\tif((buildInfo != null) && buildInfo.containsKey(\"BuildDate\")) {\n\t\t\t\tSystem.out.printf(\"Copyright (c) 2014-%s LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\\n\", buildInfo.get(\"BuildDate\").substring(7));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tSystem.out.println(\"Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\");\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t\tSystem.out.println(\"This program is free software: you can redistribute it and/or modify\");\n\t\t\tSystem.out.println(\"it under the terms of the GNU General Public License <http://www.gnu.org/>.\");\n\t\t\tSystem.out.println(\"Note that this program is distributed with ABSOLUTELY NO WARRANTY.\");\n\t\t\tSystem.out.println(\"===========================================================================\\n\");\n\t\t}\n\t}\n\t\n\t//------------------------------------------------------------------------------------------------\n\t// Processing Loop\n\t//------------------------------------------------------------------------------------------------\n\n\tpublic static void processFile(final String inputFile, final String outputFile, final int channles, final int sampleRate, final AudioFileIO.PCMFileType audioFormat) throws NoSuchAlgorithmException, IOException {\n\t\t// Open input and output files\n\t\tSystem.out.print(\"Opening input and out files...\");\n\t\ttry(AudioFileIO.PCMFileReader reader = new AudioFileIO.PCMFileReader(inputFile, channles, audioFormat)) {\n\t\t\ttry (AudioFileIO.PCMFileWriter writer =  new AudioFileIO.PCMFileWriter(outputFile, channles, audioFormat)) {\n\t\t\t\tdouble[][] sampleBuffer = new double[channles][4096];\n\t\t\t\t\n\t\t\t\tSystem.out.print(\" Done!\\nCreating normalizer instance...\");\n\t\t\t\ttry(final JDynamicAudioNormalizer instance = new JDynamicAudioNormalizer(channles, sampleRate, FRAME_LEN, FILTER_SIZE, 0.95, 10.0, 0.0, 0.0, true, false, false)) {\n\t\t\t\t\t// Process samples\n\t\t\t\t\tSystem.out.print(\" Done!\\nProcessing input samples...\");\n\t\t\t\t\tint progressUpdate = 0;\n\t\t\t\t\tfor (;;) {\n\t\t\t\t\t\tint sampleCount = 0;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tsampleCount = reader.read(sampleBuffer);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (IOException e) {\n\t\t\t\t\t\t\tthrow new IOException(\"Failed to read data from input file!\", e);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (sampleCount > 0) {\n\t\t\t\t\t\t\tfinal long outputSamples = instance.processInplace(sampleBuffer, sampleCount);\n\t\t\t\t\t\t\tif (outputSamples > 0) {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\twriter.write(sampleBuffer, (int) outputSamples);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcatch (IOException e) {\n\t\t\t\t\t\t\t\t\tthrow new IOException(\"Failed to write data to output file!\", e);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(++progressUpdate >= 13) {\n\t\t\t\t\t\t\t\tprogressUpdate = 0;\n\t\t\t\t\t\t\t\tSystem.out.print(\".\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (sampleCount < sampleBuffer[0].length) {\n\t\t\t\t\t\t\tbreak; /* EOF reached */\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// Flush pending samples\n\t\t\t\t\tSystem.out.print(\" Done!\\nFlushing remaining samples...\");\n\t\t\t\t\tfor (;;) {\n\t\t\t\t\t\tfinal long outputSamples = instance.flushBuffer(sampleBuffer);\n\t\t\t\t\t\tif (outputSamples > 0) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\twriter.write(sampleBuffer, (int) outputSamples);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (IOException e) {\n\t\t\t\t\t\t\t\tthrow new IOException(\"Failed to write data to output file!\", e);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(++progressUpdate >= 13) {\n\t\t\t\t\t\t\t\tprogressUpdate = 0;\n\t\t\t\t\t\t\t\tSystem.out.print(\".\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tbreak; /* No more samples */\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// Reset\n\t\t\t\t\tSystem.out.print(\" Done!\\nResetting normalizer instance...\");\n\t\t\t\t\tinstance.reset(); /* This is NOT normally required, but we do it here to test the reset() API */\n\t\t\t\t\t\n\t\t\t\t\t// Close input and output\n\t\t\t\t\tSystem.out.print(\" Done!\\nShutting down...\"); /*Implicitly, due to AutoCloseable*/\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t// Finished\n\t\tSystem.out.println(\" Done!\\n\\nAll done. Goodbye.\");\n\t}\n\t\n\t//------------------------------------------------------------------------------------------------\n\t// Main\n\t//------------------------------------------------------------------------------------------------\n\n\tpublic static void main(final String [] args)\n\t{\n\t\ttry {\n\t\t\t//Print program logo\n\t\t\tprintLogo();\n\t\t\t\n\t\t\t//Check number of arguments\n\t\t\tif(args.length < 2) {\n\t\t\t\tSystem.out.println(\"Usage:\");\n\t\t\t\tSystem.out.println(\"  java -jar Example.jar [<channel_count> [<sample_rate> [<sample_format>]]] <input.pcm> <output.pcm>\");\n\t\t\t\tSystem.exit(-1);\n\t\t\t}\n\t\t\t\n\t\t\t//Initialize arguments to default values\n\t\t\tint channels = CHANNELS_DEFAULT;\n\t\t\tint sampleRate = SAMPLE_RATE_DEFAULT;\n\t\t\tAudioFileIO.PCMFileType audioFormat = AUDIO_FORMAT_DEFAULT;\n\t\t\t\n\t\t\t//Parse optional arguments from command-line\n\t\t\ttry {\n\t\t\t\tif(args.length > 2) {\n\t\t\t\t\tchannels = Integer.parseInt(args[0]);\n\t\t\t\t\tif(args.length > 3) {\n\t\t\t\t\t\tsampleRate = Integer.parseInt(args[1]);\n\t\t\t\t\t\tif(args.length > 4) {\n\t\t\t\t\t\t\taudioFormat = AudioFileIO.PCMFileType.valueOf(args[2]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch(Exception e) {\n\t\t\t\tthrow new IllegalArgumentException(\"Invalid command-line argument given!\", e);\n\t\t\t}\n\t\t\t\n\t\t\t//Process the audio file\n\t\t\tfinal int offset = Math.min(args.length, 5) - 2;\n\t\t\tprocessFile(args[offset], args[offset + 1], channels, sampleRate, audioFormat);\n\t\t}\n\t\tcatch(Throwable e) {\n\t\t\tSystem.err.println(\"\\n\\nERROR: \" + e.getMessage() + \"\\n\");\n\t\t\te.printStackTrace(System.err);\n\t\t}\n\t}\n\n}\n"
  },
  {
    "path": "DynamicAudioNormalizerJNI/src/com/muldersoft/dynaudnorm/JDynamicAudioNormalizer.java",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Java/JNI Wrapper\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n// http://opensource.org/licenses/MIT\n//////////////////////////////////////////////////////////////////////////////////\n\npackage com.muldersoft.dynaudnorm;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.regex.Matcher;\nimport java.util.regex.Pattern;\n\npublic class JDynamicAudioNormalizer implements AutoCloseable\n{\n\t//------------------------------------------------------------------------------------------------\n\t// Exception class\n\t//------------------------------------------------------------------------------------------------\n\t\n\tpublic static class Error extends RuntimeException\n\t{\n\t\tprivate static final long serialVersionUID = 8560360516304094422L;\n\n\t\tpublic Error(String string)\n\t\t{\n\t\t\tsuper(string);\n\t\t}\n\t}\n\n\t//------------------------------------------------------------------------------------------------\n\t// Logging interface\n\t//------------------------------------------------------------------------------------------------\n\t\n\tpublic static abstract class Logger\n\t{\n\t\tpublic abstract void log(final int level, final String message);\n\t}\n\n\t//------------------------------------------------------------------------------------------------\n\t// Native API\n\t//------------------------------------------------------------------------------------------------\n\t\n\tprivate static class NativeAPI_r8\n\t{\n\t\tstatic NativeAPI_r8 nativeAPI = null;\n\t\t\n\t\t//Singelton\n\t\tpublic static synchronized NativeAPI_r8 getInstance()\n\t\t{\n\t\t\tif(nativeAPI == null)\n\t\t\t{\n\t\t\t\tnativeAPI = new NativeAPI_r8();\n\t\t\t}\n\t\t\treturn nativeAPI;\n\t\t}\n\t\t\n\t\t//Load native library at runtime\n\t\tprivate NativeAPI_r8()\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tfinal int coreVersion = getCoreVersion();\n\t\t\t\tSystem.loadLibrary((coreVersion > 0) ? String.format(\"DynamicAudioNormalizerAPI-%d\", coreVersion) : \"DynamicAudioNormalizerAPI\");\n\t\t\t}\n\t\t\tcatch(Throwable e)\n\t\t\t{\n\t\t\t\thandleError(e, \"Failed to load native DynamicAudioNormalizerAPI library!\");\n\t\t\t}\n\t\t}\n\t\t\n\t\t//Detect the library \"core\" version\n\t\tprivate int getCoreVersion()\n\t\t{\n\t\t\tint coreVersion = -1;\n\t\t\ttry\n\t\t\t{\n\t\t\t\tif(!System.getProperty(\"os.name\").toLowerCase().startsWith(\"win\"))\n\t\t\t\t{\n\t\t\t\t\tfinal Pattern pattern = Pattern.compile(\".+\\\\$NativeAPI_r(\\\\d+)$\");\n\t\t\t\t\tfinal Matcher matcher = pattern.matcher(this.getClass().getName());\n\t\t\t\t\tif(matcher.matches())\n\t\t\t\t\t{\n\t\t\t\t\t\tcoreVersion = Integer.parseInt(matcher.group(1));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch(Throwable e)\n\t\t\t{\n\t\t\t\thandleError(e, \"Failed to determine DynamicAudioNormalizerAPI core version!\");\n\t\t\t}\n\t\t\treturn coreVersion;\n\t\t}\n\t\t\n\t\t//Static Functions\n\t\tprivate native boolean getVersionInfo(final int versionInfo[]);\n\t\tprivate native boolean getBuildInfo(final Map<String,String> buildInfo);\n\t\tprivate native boolean setLoggingHandler(final Logger logger);\n\n\t\t//Create or Destroy Instance\n\t\tprivate native int createInstance(final int channels, final int sampleRate, final int frameLenMsec, final int filterSize, final double peakValue, final double maxAmplification, final double targetRms, final double compressFactor, final boolean channelsCoupled, final boolean enableDCCorrection, final boolean altBoundaryMode);\n\t\tprivate native boolean destroyInstance(final int handle);\n\t\t\n\t\t//Processing Functions\n\t\tprivate native long process(final int handle, final double [][] samplesIn, final double [][] samplesOut, final long inputSize);\n\t\tprivate native long processInplace(final int handle, final double [][] samplesInOut, final long inputSize);\n\t\tprivate native long flushBuffer(final int handle, final double [][] samplesOut);\n\t\tprivate native boolean reset(final int handle);\n\t\t\n\t\t//Other Functions\n\t\tprivate native boolean getConfiguration(final int handle, final Map<String,Integer> buildInfo);\n\t\tprivate native long getInternalDelay(final int handle);\n\t}\n\t\n\t//------------------------------------------------------------------------------------------------\n\t// Static Functions\n\t//------------------------------------------------------------------------------------------------\n\n\tpublic static synchronized int[] getVersionInfo()\n\t{\n\t\tboolean success = false;\n\t\tint[] versionInfo = new int[3];\n\t\t\n\t\ttry\n\t\t{\n\t\t\tsuccess = NativeAPI_r8.getInstance().getVersionInfo(versionInfo);\n\t\t}\n\t\tcatch(Throwable e)\n\t\t{\n\t\t\thandleError(e, \"Failed to call native DynamicAudioNormalizerAPI function!\");\n\t\t}\n\n\t\tif(!success)\n\t\t{\n\t\t\tthrow new Error(\"Failed to retrieve version info from native library!\");\n\t\t}\n\t\t\n\t\treturn versionInfo;\n\t}\n\n\tpublic static synchronized Map<String,String> getBuildInfo()\n\t{\n\t\tboolean success = false;\n\t\tMap<String,String> buildInfo = new HashMap<String, String>();\n\t\t\n\t\ttry\n\t\t{\n\t\t\tsuccess = NativeAPI_r8.getInstance().getBuildInfo(buildInfo);\n\t\t}\n\t\tcatch(Throwable e)\n\t\t{\n\t\t\thandleError(e, \"Failed to call native DynamicAudioNormalizerAPI function!\");\n\t\t}\n\n\t\tif(!success)\n\t\t{\n\t\t\tthrow new Error(\"Failed to retrieve build info from native library!\");\n\t\t}\n\t\t\n\t\treturn buildInfo;\n\t}\n\t\n\tpublic static synchronized void setLoggingHandler(final Logger logger)\n\t{\n\t\tboolean success = false;\n\t\t\n\t\ttry\n\t\t{\n\t\t\tsuccess = NativeAPI_r8.getInstance().setLoggingHandler(logger);\n\t\t}\n\t\tcatch(Throwable e)\n\t\t{\n\t\t\thandleError(e, \"Failed to call native DynamicAudioNormalizerAPI function!\");\n\t\t}\n\t\t\n\t\tif(!success)\n\t\t{\n\t\t\tthrow new Error(\"Failed to setup new logging handler!\");\n\t\t}\n\t}\n\t\n\t//------------------------------------------------------------------------------------------------\n\t// Constructor, Close() and Finalizer\n\t//------------------------------------------------------------------------------------------------\n\n\tprivate int m_instance = -1;\n\t\n\tpublic JDynamicAudioNormalizer(final int channels, final int sampleRate, final int frameLenMsec, final int filterSize, final double peakValue, final double maxAmplification, final double targetRms, final double compressFactor, final boolean channelsCoupled, final boolean enableDCCorrection, final boolean altBoundaryMode)\n\t{\n\t\ttry\n\t\t{\n\t\t\tm_instance = NativeAPI_r8.getInstance().createInstance(channels, sampleRate, frameLenMsec, filterSize, peakValue, maxAmplification, targetRms, compressFactor, channelsCoupled, enableDCCorrection, altBoundaryMode);\n\t\t}\n\t\tcatch(Throwable e)\n\t\t{\n\t\t\thandleError(e, \"Failed to call native DynamicAudioNormalizerAPI function!\");\n\t\t}\n\n\t\tif(m_instance < 0)\n\t\t{\n\t\t\tthrow new Error(\"Failed to create native DynamicAudioNormalizer instance!\");\n\t\t}\n\t}\n\t\n\tpublic synchronized void close()\n\t{\n\t\tif(m_instance >= 0)\n\t\t{\n\t\t\tboolean success = false;\n\t\t\ttry\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tsuccess = NativeAPI_r8.getInstance().destroyInstance(m_instance);\n\t\t\t\t}\n\t\t\t\tfinally\n\t\t\t\t{\n\t\t\t\t\tm_instance = -1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch(Throwable e)\n\t\t\t{\n\t\t\t\thandleError(e, \"Failed to call native DynamicAudioNormalizerAPI function!\");\n\t\t\t}\n\t\t\t\n\t\t\tif(!success)\n\t\t\t{\n\t\t\t\tthrow new Error(\"Failed to destroy native DynamicAudioNormalizer instance!\");\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprotected synchronized void finalize()\n\t{\n\t\tclose();\n\t}\n\t\n\t//------------------------------------------------------------------------------------------------\n\t// Processing Functions\n\t//------------------------------------------------------------------------------------------------\n\n\tpublic synchronized long process(final double [][] samplesIn, final double [][] samplesOut, final long inputSize)\n\t{\n\t\tcheckInstance(); /*make sure we are properly initialized*/\n\n\t\tlong outputSize = 0;\n\t\ttry\n\t\t{\n\t\t\toutputSize = NativeAPI_r8.getInstance().process(m_instance, samplesIn, samplesOut, inputSize);\n\t\t}\n\t\tcatch(Throwable e)\n\t\t{\n\t\t\thandleError(e, \"Failed to call native DynamicAudioNormalizerAPI function!\");\n\t\t}\t\n\t\t\n\t\tif(outputSize < 0)\n\t\t{\n\t\t\tthrow new Error(\"Failed to process the audio samples!\");\n\t\t}\n\n\t\treturn outputSize;\n\t}\n\t\n\tpublic synchronized long processInplace(final double [][] samplesInOut, final long inputSize)\n\t{\n\t\tcheckInstance(); /*make sure we are properly initialized*/\n\n\t\tlong outputSize = 0;\n\t\ttry\n\t\t{\n\t\t\toutputSize = NativeAPI_r8.getInstance().processInplace(m_instance, samplesInOut, inputSize);\n\t\t}\n\t\tcatch(Throwable e)\n\t\t{\n\t\t\thandleError(e, \"Failed to call native DynamicAudioNormalizerAPI function!\");\n\t\t}\t\n\t\t\n\t\tif(outputSize < 0)\n\t\t{\n\t\t\tthrow new Error(\"Failed to process the audio samples inplace!\");\n\t\t}\n\n\t\treturn outputSize;\n\t}\n\t\n\tpublic synchronized long flushBuffer(final double [][] samplesOut)\n\t{\n\t\tcheckInstance(); /*make sure we are properly initialized*/\n\n\t\tlong outputSize = 0;\n\t\ttry\n\t\t{\n\t\t\toutputSize = NativeAPI_r8.getInstance().flushBuffer(m_instance, samplesOut);\n\t\t}\n\t\tcatch(Throwable e)\n\t\t{\n\t\t\thandleError(e, \"Failed to call native DynamicAudioNormalizerAPI function!\");\n\t\t}\t\n\t\t\n\t\tif(outputSize < 0)\n\t\t{\n\t\t\tthrow new Error(\"Failed to flush samples from buffer!\");\n\t\t}\n\n\t\treturn outputSize;\n\t}\n\t\n\tpublic synchronized void reset()\n\t{\n\t\tcheckInstance(); /*make sure we are properly initialized*/\n\n\t\tboolean success = false;\n\t\ttry\n\t\t{\n\t\t\tsuccess = NativeAPI_r8.getInstance().reset(m_instance);\n\t\t}\n\t\tcatch(Throwable e)\n\t\t{\n\t\t\thandleError(e, \"Failed to call native DynamicAudioNormalizerAPI function!\");\n\t\t}\t\n\t\t\n\t\tif(!success)\n\t\t{\n\t\t\tthrow new Error(\"Failed to reset DynamicAudioNormalizerAPI instance!\");\n\t\t}\n\t}\n\t\n\t//------------------------------------------------------------------------------------------------\n\t// Other Functions\n\t//------------------------------------------------------------------------------------------------\n\n\tpublic synchronized Map<String,Integer> getConfiguration()\n\t{\n\t\tcheckInstance(); /*make sure we are properly initialized*/\n\t\t\n\t\tboolean success = false;\n\t\tMap<String,Integer> configuration = new HashMap<String,Integer>();\n\t\t\n\t\ttry\n\t\t{\n\t\t\tsuccess = NativeAPI_r8.getInstance().getConfiguration(m_instance, configuration);\n\t\t}\n\t\tcatch(Throwable e)\n\t\t{\n\t\t\thandleError(e, \"Failed to call native DynamicAudioNormalizerAPI function!\");\n\t\t}\n\n\t\tif(!success)\n\t\t{\n\t\t\tthrow new Error(\"Failed to retrieve DynamicAudioNormalizerAPI configuration!\");\n\t\t}\n\t\t\n\t\treturn configuration;\n\t}\n\t\n\tpublic synchronized long getInternalDelay()\n\t{\n\t\tcheckInstance(); /*make sure we are properly initialized*/\n\t\t\n\t\tlong internalDelay = -1;\n\t\ttry\n\t\t{\n\t\t\tinternalDelay = NativeAPI_r8.getInstance().getInternalDelay(m_instance);\n\t\t}\n\t\tcatch(Throwable e)\n\t\t{\n\t\t\thandleError(e, \"Failed to call native DynamicAudioNormalizerAPI function!\");\n\t\t}\n\n\t\tif(internalDelay < 0)\n\t\t{\n\t\t\tthrow new Error(\"Failed to retrieve DynamicAudioNormalizerAPI internal delay!\");\n\t\t}\n\t\t\n\t\treturn internalDelay;\n\t}\n\t\n\t@Deprecated\n\tpublic synchronized int getHandle()\n\t{\n\t\treturn m_instance;\n\t}\n\t\n\t//------------------------------------------------------------------------------------------------\n\t// Internal functions\n\t//------------------------------------------------------------------------------------------------\n\n\tprivate static void handleError(final Throwable e, final String message)\n\t{\n\t\tif(e.getClass() == Error.class)\n\t\t{\n\t\t\tthrow (Error) e; /*pass through our own exceptions*/\n\t\t}\n\t\telse\n\t\t{\n\t\t\tthrow new Error(String.format(\"%s [Reason: %s, Message: \\\"%s\\\"]\", message, e.getClass().getName(), e.getMessage()));\n\t\t}\n\t}\n\n\tprivate void checkInstance()\n\t{\n\t\tif(m_instance < 0)\n\t\t{\n\t\t\tthrow new Error(\"Native DynamicAudioNormalizer object not created yet or released already!\");\n\t\t}\n\t}\n\t//------------------------------------------------------------------------------------------------\n\t// Main\n\t//------------------------------------------------------------------------------------------------\n\n\tpublic static void main(String [] args)\n\t{\n\t\tint [] ver = null;\n\t\tException error = null;\n\t\ttry\n\t\t{\n\t\t\tver = getVersionInfo();\n\t\t}\n\t\tcatch(Exception ex)\n\t\t{\n\t\t\terror = ex;\n\t\t}\n\t\t\n\t\tSystem.out.println(\"\\n===========================================================================\");\n\t\tif((ver != null) && (ver.length >= 3))\n\t\t{\n\t\t\tSystem.out.printf(\"Dynamic Audio Normalizer, Version %d.%02d-%d\\n\", ver[0], ver[1], ver[2]);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tSystem.out.println(\"Dynamic Audio Normalizer, Unknown Version\");\n\t\t}\n\t\tSystem.out.println(\"Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\");\n\t\tSystem.out.println();\n\t\tSystem.out.println(\"This program is free software: you can redistribute it and/or modify\");\n\t\tSystem.out.println(\"it under the terms of the GNU General Public License <http://www.gnu.org/>.\");\n\t\tSystem.out.println(\"Note that this program is distributed with ABSOLUTELY NO WARRANTY.\");\n\t\tSystem.out.println(\"===========================================================================\\n\");\n\t\t\n\t\tif((error != null)) {\n\t\t\tSystem.out.printf(\"ERROR: %s\\n%s\\n\", error.getClass().toString(), error.getMessage());\n\t\t}\n\t\telse {\n\t\t\tSystem.out.println(\"That's all. Goodbye.\");\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "DynamicAudioNormalizerJNI/test/com/muldersoft/dynaudnorm/test/JDynamicAudioNormalizerTest.java",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Java/JNI Wrapper\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n// http://opensource.org/licenses/MIT\n//////////////////////////////////////////////////////////////////////////////////\n\npackage com.muldersoft.dynaudnorm.test;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.fail;\n\nimport java.io.ByteArrayOutputStream;\nimport java.io.DataOutputStream;\nimport java.io.IOException;\nimport java.security.MessageDigest;\nimport java.security.NoSuchAlgorithmException;\nimport java.security.SecureRandom;\nimport java.util.Formatter;\nimport java.util.Iterator;\nimport java.util.LinkedList;\nimport java.util.Map;\nimport java.util.Queue;\n\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.FixMethodOrder;\nimport org.junit.Test;\nimport org.junit.runners.MethodSorters;\n\nimport com.muldersoft.dynaudnorm.JDynamicAudioNormalizer;\nimport com.muldersoft.dynaudnorm.JDynamicAudioNormalizer.Logger;\nimport com.muldersoft.dynaudnorm.samples.AudioFileIO;\n\n@FixMethodOrder(MethodSorters.NAME_ASCENDING)\npublic class JDynamicAudioNormalizerTest {\n\n\t// ------------------------------------------------------------------------------------------------\n\t// Randomization\n\t// ------------------------------------------------------------------------------------------------\n\n\tprivate static void double2DArrayRandom(double[][] output) {\n\t\tfinal SecureRandom rand = new SecureRandom();\n\t\tfinal double amp = Math.max(0.125, rand.nextDouble());\n\t\tfor (final double[] channel : output) {\n\t\t\tfor (int i = 0; i < channel.length; ++i) {\n\t\t\t\tfinal double sign = rand.nextBoolean() ? 1.0 : (-1.0);\n\t\t\t\tchannel[i] = amp *sign * rand.nextDouble();\n\t\t\t}\n\t\t}\n\t}\n\t// ------------------------------------------------------------------------------------------------\n\t// Hash Computation\n\t// ------------------------------------------------------------------------------------------------\n\n\tpublic static String sha1sum(double[][] input) throws NoSuchAlgorithmException, IOException {\n\t\tfinal MessageDigest md = MessageDigest.getInstance(\"SHA-1\");\n\t\treturn byteArrayToHex(md.digest(double2DArrayToBytes(input)));\n\t}\n\n\tprivate static byte[] double2DArrayToBytes(double[][] input) throws IOException {\n\t\ttry (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {\n\t\t\ttry (DataOutputStream dos = new DataOutputStream(baos)) {\n\t\t\t\tfor (final double[] channel : input) {\n\t\t\t\t\tfor (final double d : channel) {\n\t\t\t\t\t\tdos.writeDouble(d);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdos.flush();\n\t\t\t\treturn baos.toByteArray();\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static String byteArrayToHex(final byte[] hash) {\n\t\ttry (final Formatter formatter = new Formatter()) {\n\t\t\tfor (byte b : hash) {\n\t\t\t\tformatter.format(\"%02X\", b);\n\t\t\t}\n\t\t\treturn formatter.toString();\n\t\t}\n\t}\n\n\t// ------------------------------------------------------------------------------------------------\n\t// Test Functions\n\t// ------------------------------------------------------------------------------------------------\n\n\t@Before\n\tpublic void setUp() {\n\t\tSystem.out.println(\"\\n============================= TEST BEGIN =============================\");\n\t}\n\n\t@After\n\tpublic void shutDown() {\n\t\tSystem.out.println(\"============================= TEST DONE! =============================\\n\");\n\t}\n\n\t@Test\n\tpublic void test1_setLoggingHandler() {\n\t\tJDynamicAudioNormalizer.setLoggingHandler(new Logger() {\n\t\t\tpublic void log(final int level, final String message) {\n\t\t\t\tString label = \"???\";\n\t\t\t\tswitch (level) {\n\t\t\t\tcase 0:\n\t\t\t\t\tlabel = \"DBG\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\tlabel = \"WRN\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\tlabel = \"ERR\";\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tSystem.err.printf(\"[JDynAudNorm][%s] %s\\n\", label, message);\n\t\t\t}\n\t\t});\n\t\tSystem.out.println(\"Message handler installed successfully.\");\n\t}\n\n\t@Test\n\tpublic void test2_getVersionInfo() {\n\t\tfinal int[] versionInfo = JDynamicAudioNormalizer.getVersionInfo();\n\t\tSystem.out.printf(\"Library Version: %d.%02d-%d\\n\", versionInfo[0], versionInfo[1], versionInfo[2]);\n\t}\n\n\t@Test\n\tpublic void test3_getBuildInfo() {\n\t\tfinal Map<String, String> buildInfo = JDynamicAudioNormalizer.getBuildInfo();\n\t\tfor (final String key : buildInfo.keySet()) {\n\t\t\tSystem.out.println(\"Build Info: \" + key + \"=\" + buildInfo.get(key));\n\t\t}\n\t}\n\n\t@Test\n\tpublic void test4_getConfiguration() {\n\t\tJDynamicAudioNormalizer instance = new JDynamicAudioNormalizer(2, 44100, 500, 31, 0.95, 10.0, 0.0, 0.0, true, false, false);\n\t\tfinal Map<String, Integer> buildInfo = instance.getConfiguration();\n\t\tfor (final String key : buildInfo.keySet()) {\n\t\t\tSystem.out.printf(\"Configuration: %s=%s\\n\", key, buildInfo.get(key));\n\t\t}\n\t\tinstance.close();\n\t}\n\n\t@Test\n\tpublic void test5_getInternalDelay() {\n\t\tJDynamicAudioNormalizer instance = new JDynamicAudioNormalizer(2, 44100, 500, 31, 0.95, 10.0, 0.0, 0.0, true, false, false);\n\t\tfinal long delayedSamples = instance.getInternalDelay();\n\t\tSystem.out.printf(\"Delayed Samples: %d\\n\", delayedSamples);\n\t\tinstance.close();\n\t}\n\n\t@Test\n\t@SuppressWarnings(\"deprecation\")\n\tpublic void test6_constructorAndRelease() {\n\t\tfinal int MAX_ROUNDS = 512;\n\t\tfinal int MAX_INSTANCES = 56;\n\n\t\tfor (int i = 0; i < MAX_ROUNDS; i++) {\n\t\t\tSystem.out.println(\"--------------------------------------------------------------------------\");\n\t\t\tSystem.out.printf(\"Round %d of %d\\n\", i + 1, MAX_ROUNDS);\n\t\t\tSystem.out.println(\"--------------------------------------------------------------------------\");\n\n\t\t\tQueue<JDynamicAudioNormalizer> instances = new LinkedList<JDynamicAudioNormalizer>();\n\n\t\t\t// Constructor\n\t\t\tfor (int k = 0; k < MAX_INSTANCES; k++) {\n\t\t\t\tJDynamicAudioNormalizer instance = new JDynamicAudioNormalizer(2, 44100, 500, 31, 0.95, 10.0, 0.0, 0.0, true, false, false);\n\t\t\t\tSystem.out.printf(\"Handle: %08X\\n\", instance.getHandle());\n\t\t\t\tinstances.add(instance);\n\t\t\t}\n\n\t\t\t// Process at least one chunk of data with every instance\n\t\t\tdouble[][] sampleBuffer = new double[2][4096];\n\t\t\tfor (Iterator<JDynamicAudioNormalizer> k = instances.iterator(); k.hasNext(); /* next */) {\n\t\t\t\tk.next().processInplace(sampleBuffer, sampleBuffer[0].length);\n\t\t\t}\n\t\t\t// Release\n\t\t\twhile (!instances.isEmpty()) {\n\t\t\t\tinstances.poll().close();\n\t\t\t}\n\t\t}\n\t}\n\n\t@Test\n\tpublic void test7_processRandomData() {\n\t\tfinal int MAX_PASS = 2;\n\t\tfinal int MAX_LENGTH = 9973;\n\t\t\n\t\tfinal double[] TARGET_RMS = { 0.0, 0.75 };\n\t\tfinal double[] COMPRESS = { 0.0, 5.0 };\n\t\tfinal boolean[] CCOUPLING = { true, false };\n\t\tfinal boolean[] DCCORRECT = { false, true };\n\t\tfinal boolean[] BOUNDARYM = { false, true };\n\t\t\n\t\t\n\t\tfor(int p = 0; p < MAX_PASS; ++p) {\n\t\t\tdouble[][] sampleBuffer = new double[2][4096];\n\t\t\ttry(final JDynamicAudioNormalizer instance = new JDynamicAudioNormalizer(2, 44100, 500, 31, 0.95, 10.0, TARGET_RMS[p], COMPRESS[p], CCOUPLING[p], DCCORRECT[p], BOUNDARYM[p])) {\n\t\t\t\tfor(int i = 0; i < MAX_LENGTH; ++i) {\n\t\t\t\t\tif(i % 97 == 0) {\n\t\t\t\t\t\tSystem.out.printf(\"Pass %d of %d, Round %d of %d... [%.1f%%]\\n\", p+1, MAX_PASS, i, MAX_LENGTH, (((double)i) / MAX_LENGTH) * 100.0);\n\t\t\t\t\t}\n\t\t\t\t\tdouble2DArrayRandom(sampleBuffer);\n\t\t\t\t\tinstance.processInplace(sampleBuffer, sampleBuffer[0].length);\n\t\t\t\t}\n\t\t\t\tSystem.out.printf(\"Pass %d of %d, Round %d of %d... [%.1f%%]\\n\", p+1, MAX_PASS, MAX_LENGTH, MAX_LENGTH, 100.0);\n\t\t\t}\n\t\t}\n\t}\n\t\n\t@Test\n\tpublic void test8_processAudioFile() throws NoSuchAlgorithmException, IOException {\n\t\t// Open input and output files\n\t\tSystem.out.println(\"Opening input and out files...\");\n\t\ttry(AudioFileIO.PCMFileReader reader = new AudioFileIO.PCMFileReader(\"Input.pcm\", 2, AudioFileIO.PCMFileType.PCM_16BIT_LE)) {\n\t\t\ttry (AudioFileIO.PCMFileWriter writer =  new AudioFileIO.PCMFileWriter(\"Output.pcm\", 2, AudioFileIO.PCMFileType.PCM_16BIT_LE)) {\n\t\t\t\tdouble[][] sampleBuffer = new double[2][4096];\n\t\t\t\t\n\t\t\t\tSystem.out.println(\"Creating normalizer instance...\");\n\t\t\t\ttry(final JDynamicAudioNormalizer instance = new JDynamicAudioNormalizer(2, 44100, 500, 31, 0.95, 10.0, 0.0, 0.0, true, false, false)) {\n\t\t\t\t\t// Process samples\n\t\t\t\t\tSystem.out.println(\"Processing input samples...\");\n\t\t\t\t\tfor (;;) {\n\t\t\t\t\t\tint sampleCount = 0;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tsampleCount = reader.read(sampleBuffer);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (IOException e) {\n\t\t\t\t\t\t\tfail(\"Failed to read from input file!\");\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (sampleCount > 0) {\n\t\t\t\t\t\t\tfinal long outputSamples = instance.processInplace(sampleBuffer, sampleCount);\n\t\t\t\t\t\t\tif (outputSamples > 0) {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\twriter.write(sampleBuffer, (int) outputSamples);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcatch (IOException e) {\n\t\t\t\t\t\t\t\t\tfail(\"Failed to write to output file!\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (sampleCount < sampleBuffer[0].length) {\n\t\t\t\t\t\t\tbreak; /* EOF reached */\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Flush pending samples\n\t\t\t\t\tSystem.out.println(\"Flushing remaining samples...\");\n\t\t\t\t\tfor (;;) {\n\t\t\t\t\t\tfinal long outputSamples = instance.flushBuffer(sampleBuffer);\n\t\t\t\t\t\tif (outputSamples > 0) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\twriter.write(sampleBuffer, (int) outputSamples);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (IOException e) {\n\t\t\t\t\t\t\t\tfail(\"Failed to write to output file!\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tbreak; /* No more samples */\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Reset\n\t\t\t\t\tSystem.out.println(\"Resetting normalizer instance...\");\n\t\t\t\t\tinstance.reset(); /* This is NOT normally required, but we do it here to test the reset() API */\n\t\t\t\t\t\n\t\t\t\t\t// Close input and output\n\t\t\t\t\tSystem.out.println(\"Shutting down...\"); /*Implicitly, due to AutoCloseable*/\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t// Finished\n\t\tSystem.out.println(\"Completed.\");\n\t}\n\n\t@Test\n\tpublic void test9_processAudioFile_outOfPlace() throws NoSuchAlgorithmException, IOException {\n\t\t// Open input and output files\n\t\tSystem.out.println(\"Opening input and out files...\");\n\t\ttry(AudioFileIO.PCMFileReader reader = new AudioFileIO.PCMFileReader(\"Input.pcm\", 2, AudioFileIO.PCMFileType.PCM_16BIT_LE)) {\n\t\t\ttry (AudioFileIO.PCMFileWriter writer =  new AudioFileIO.PCMFileWriter(\"Output.pcm\", 2, AudioFileIO.PCMFileType.PCM_16BIT_LE)) {\n\t\t\t\tdouble[][] sampleBufferSrc = new double[2][4096];\n\t\t\t\tdouble[][] sampleBufferDst = new double[2][4096];\n\t\t\t\t\n\t\t\t\tSystem.out.println(\"Creating normalizer instance...\");\n\t\t\t\ttry(final JDynamicAudioNormalizer instance = new JDynamicAudioNormalizer(2, 44100, 500, 31, 0.95, 10.0, 0.0, 0.0, true, false, false)) {\n\t\t\t\t\t// Process samples\n\t\t\t\t\tSystem.out.println(\"Processing input samples...\");\n\t\t\t\t\tfor (;;) {\n\t\t\t\t\t\tint sampleCount = 0;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tsampleCount = reader.read(sampleBufferSrc);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (IOException e) {\n\t\t\t\t\t\t\tfail(\"Failed to read from input file!\");\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfinal String hashOrig = sha1sum(sampleBufferSrc);\n\t\t\t\t\t\tif (sampleCount > 0) {\n\t\t\t\t\t\t\tfinal long outputSamples = instance.process(sampleBufferSrc, sampleBufferDst, sampleCount);\n\t\t\t\t\t\t\tif (outputSamples > 0) {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\twriter.write(sampleBufferDst, (int) outputSamples);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcatch (IOException e) {\n\t\t\t\t\t\t\t\t\tfail(\"Failed to write to output file!\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfinal String hashFinal = sha1sum(sampleBufferSrc);\n\t\t\t\t\t\tassertEquals(\"Input buffer contents have been distrubed!\", hashOrig, hashFinal);\n\n\t\t\t\t\t\tif (sampleCount < sampleBufferSrc[0].length) {\n\t\t\t\t\t\t\tbreak; /* EOF reached */\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Flush pending samples\n\t\t\t\t\tSystem.out.println(\"Flushing remaining samples...\");\n\t\t\t\t\tfor (;;) {\n\t\t\t\t\t\tfinal long outputSamples = instance.flushBuffer(sampleBufferDst);\n\t\t\t\t\t\tif (outputSamples > 0) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\twriter.write(sampleBufferDst, (int) outputSamples);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcatch (IOException e) {\n\t\t\t\t\t\t\t\tfail(\"Failed to write to output file!\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tbreak; /* No more samples */\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Reset\n\t\t\t\t\tSystem.out.println(\"Resetting normalizer instance...\");\n\t\t\t\t\tinstance.reset(); /* This is NOT normally required, but we do it here to test the reset() API */\n\n\t\t\t\t\t// Close input and output\n\t\t\t\t\tSystem.out.println(\"Shutting down...\"); /*Implicitly, due to AutoCloseable*/\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t// Finished\n\t\tSystem.out.println(\"Completed.\");\n\t}\n}\n"
  },
  {
    "path": "DynamicAudioNormalizerNET/DynamicAudioNormalizerNET_VS2013.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"12.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"Debug|Win32\">\n      <Configuration>Debug</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Debug|x64\">\n      <Configuration>Debug</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|Win32\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|x64\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|Win32\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|x64\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <ProjectGuid>{E1794071-AB51-45C7-B215-028F3DAA2219}</ProjectGuid>\n    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\n    <Keyword>ManagedCProj</Keyword>\n    <RootNamespace>DynamicAudioNormalizerNET</RootNamespace>\n    <ProjectName>DynamicAudioNormalizerNET</ProjectName>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <CLRSupport>true</CLRSupport>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <CLRSupport>true</CLRSupport>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <CLRSupport>true</CLRSupport>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <CLRSupport>true</CLRSupport>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <CLRSupport>true</CLRSupport>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <CLRSupport>true</CLRSupport>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <LinkIncremental>true</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <LinkIncremental>true</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include</AdditionalIncludeDirectories>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n      <EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>\n    </ClCompile>\n    <Link>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalDependencies>\n      </AdditionalDependencies>\n      <SubSystem>Console</SubSystem>\n      <AdditionalLibraryDirectories>\n      </AdditionalLibraryDirectories>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include</AdditionalIncludeDirectories>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n    </ClCompile>\n    <Link>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalDependencies>\n      </AdditionalDependencies>\n      <SubSystem>Console</SubSystem>\n      <AdditionalLibraryDirectories>\n      </AdditionalLibraryDirectories>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include</AdditionalIncludeDirectories>\n      <Optimization>MaxSpeed</Optimization>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <FloatingPointModel>Fast</FloatingPointModel>\n    </ClCompile>\n    <Link>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <AdditionalDependencies>\n      </AdditionalDependencies>\n      <SubSystem>Console</SubSystem>\n      <OptimizeReferences>true</OptimizeReferences>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <AdditionalLibraryDirectories>\n      </AdditionalLibraryDirectories>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include</AdditionalIncludeDirectories>\n      <Optimization>MaxSpeed</Optimization>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n    </ClCompile>\n    <Link>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <AdditionalDependencies>\n      </AdditionalDependencies>\n      <SubSystem>Console</SubSystem>\n      <OptimizeReferences>true</OptimizeReferences>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <AdditionalLibraryDirectories>\n      </AdditionalLibraryDirectories>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include</AdditionalIncludeDirectories>\n      <Optimization>MaxSpeed</Optimization>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <OmitFramePointers>true</OmitFramePointers>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n    </ClCompile>\n    <Link>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <AdditionalDependencies>\n      </AdditionalDependencies>\n      <SubSystem>Console</SubSystem>\n      <OptimizeReferences>true</OptimizeReferences>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <AdditionalLibraryDirectories>\n      </AdditionalLibraryDirectories>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include</AdditionalIncludeDirectories>\n      <Optimization>MaxSpeed</Optimization>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <OmitFramePointers>true</OmitFramePointers>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <FloatingPointModel>Fast</FloatingPointModel>\n    </ClCompile>\n    <Link>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <AdditionalDependencies>\n      </AdditionalDependencies>\n      <SubSystem>Console</SubSystem>\n      <OptimizeReferences>true</OptimizeReferences>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <AdditionalLibraryDirectories>\n      </AdditionalLibraryDirectories>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemGroup>\n    <Reference Include=\"System\" />\n    <Reference Include=\"System.Data\" />\n    <Reference Include=\"System.Xml\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\AssemblyInfo.cpp\" />\n    <ClCompile Include=\"src\\DynamicAudioNormalizerNET.cpp\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"src\\DynamicAudioNormalizerNET.h\" />\n    <ClInclude Include=\"src\\resource.h\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\DynamicAudioNormalizerAPI\\DynamicAudioNormalizerAPI_VS2013.vcxproj\">\n      <Project>{376386ee-8268-47e3-a335-7663716e4c60}</Project>\n      <Private>true</Private>\n      <ReferenceOutputAssembly>true</ReferenceOutputAssembly>\n      <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>\n      <LinkLibraryDependencies>true</LinkLibraryDependencies>\n      <UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>\n    </ProjectReference>\n  </ItemGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerNET/DynamicAudioNormalizerNET_VS2013.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\AssemblyInfo.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\DynamicAudioNormalizerNET.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"src\\resource.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\DynamicAudioNormalizerNET.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerNET/DynamicAudioNormalizerNET_VS2015.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"14.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"Debug|Win32\">\n      <Configuration>Debug</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Debug|x64\">\n      <Configuration>Debug</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|Win32\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|x64\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|Win32\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|x64\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <ProjectGuid>{E1794071-AB51-45C7-B215-028F3DAA2219}</ProjectGuid>\n    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>\n    <Keyword>ManagedCProj</Keyword>\n    <RootNamespace>DynamicAudioNormalizerNET</RootNamespace>\n    <ProjectName>DynamicAudioNormalizerNET</ProjectName>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <CLRSupport>true</CLRSupport>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <CLRSupport>true</CLRSupport>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <CLRSupport>true</CLRSupport>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <CLRSupport>true</CLRSupport>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <CLRSupport>true</CLRSupport>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <CLRSupport>true</CLRSupport>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <LinkIncremental>true</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <LinkIncremental>true</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include</AdditionalIncludeDirectories>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n      <EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>\n    </ClCompile>\n    <Link>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalDependencies>\n      </AdditionalDependencies>\n      <SubSystem>Console</SubSystem>\n      <AdditionalLibraryDirectories>\n      </AdditionalLibraryDirectories>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include</AdditionalIncludeDirectories>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n    </ClCompile>\n    <Link>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalDependencies>\n      </AdditionalDependencies>\n      <SubSystem>Console</SubSystem>\n      <AdditionalLibraryDirectories>\n      </AdditionalLibraryDirectories>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include</AdditionalIncludeDirectories>\n      <Optimization>MaxSpeed</Optimization>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <FloatingPointModel>Fast</FloatingPointModel>\n    </ClCompile>\n    <Link>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <AdditionalDependencies>\n      </AdditionalDependencies>\n      <SubSystem>Console</SubSystem>\n      <OptimizeReferences>true</OptimizeReferences>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <AdditionalLibraryDirectories>\n      </AdditionalLibraryDirectories>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include</AdditionalIncludeDirectories>\n      <Optimization>MaxSpeed</Optimization>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n    </ClCompile>\n    <Link>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <AdditionalDependencies>\n      </AdditionalDependencies>\n      <SubSystem>Console</SubSystem>\n      <OptimizeReferences>true</OptimizeReferences>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <AdditionalLibraryDirectories>\n      </AdditionalLibraryDirectories>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include</AdditionalIncludeDirectories>\n      <Optimization>MaxSpeed</Optimization>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <OmitFramePointers>true</OmitFramePointers>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n    </ClCompile>\n    <Link>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <AdditionalDependencies>\n      </AdditionalDependencies>\n      <SubSystem>Console</SubSystem>\n      <OptimizeReferences>true</OptimizeReferences>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <AdditionalLibraryDirectories>\n      </AdditionalLibraryDirectories>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include</AdditionalIncludeDirectories>\n      <Optimization>MaxSpeed</Optimization>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <OmitFramePointers>true</OmitFramePointers>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <FloatingPointModel>Fast</FloatingPointModel>\n    </ClCompile>\n    <Link>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <AdditionalDependencies>\n      </AdditionalDependencies>\n      <SubSystem>Console</SubSystem>\n      <OptimizeReferences>true</OptimizeReferences>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <AdditionalLibraryDirectories>\n      </AdditionalLibraryDirectories>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemGroup>\n    <Reference Include=\"System\" />\n    <Reference Include=\"System.Data\" />\n    <Reference Include=\"System.Xml\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\AssemblyInfo.cpp\" />\n    <ClCompile Include=\"src\\DynamicAudioNormalizerNET.cpp\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"src\\DynamicAudioNormalizerNET.h\" />\n    <ClInclude Include=\"src\\resource.h\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\DynamicAudioNormalizerAPI\\DynamicAudioNormalizerAPI_VS2015.vcxproj\">\n      <Project>{376386ee-8268-47e3-a335-7663716e4c60}</Project>\n      <Private>true</Private>\n      <ReferenceOutputAssembly>true</ReferenceOutputAssembly>\n      <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>\n      <LinkLibraryDependencies>true</LinkLibraryDependencies>\n      <UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>\n    </ProjectReference>\n  </ItemGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerNET/DynamicAudioNormalizerNET_VS2015.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\AssemblyInfo.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\DynamicAudioNormalizerNET.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"src\\resource.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\DynamicAudioNormalizerNET.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerNET/DynamicAudioNormalizerNET_VS2017.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"14.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"Debug|Win32\">\n      <Configuration>Debug</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Debug|x64\">\n      <Configuration>Debug</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|Win32\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|x64\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|Win32\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|x64\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <ProjectGuid>{E1794071-AB51-45C7-B215-028F3DAA2219}</ProjectGuid>\n    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>\n    <Keyword>ManagedCProj</Keyword>\n    <RootNamespace>DynamicAudioNormalizerNET</RootNamespace>\n    <ProjectName>DynamicAudioNormalizerNET</ProjectName>\n    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <CLRSupport>true</CLRSupport>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <CLRSupport>true</CLRSupport>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <CLRSupport>true</CLRSupport>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <CLRSupport>true</CLRSupport>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <CLRSupport>true</CLRSupport>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <CLRSupport>true</CLRSupport>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <LinkIncremental>true</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <LinkIncremental>true</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include</AdditionalIncludeDirectories>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n      <EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>\n    </ClCompile>\n    <Link>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalDependencies>\n      </AdditionalDependencies>\n      <SubSystem>Console</SubSystem>\n      <AdditionalLibraryDirectories>\n      </AdditionalLibraryDirectories>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include</AdditionalIncludeDirectories>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n    </ClCompile>\n    <Link>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalDependencies>\n      </AdditionalDependencies>\n      <SubSystem>Console</SubSystem>\n      <AdditionalLibraryDirectories>\n      </AdditionalLibraryDirectories>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include</AdditionalIncludeDirectories>\n      <Optimization>MaxSpeed</Optimization>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <FloatingPointModel>Fast</FloatingPointModel>\n    </ClCompile>\n    <Link>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <AdditionalDependencies>\n      </AdditionalDependencies>\n      <SubSystem>Console</SubSystem>\n      <OptimizeReferences>true</OptimizeReferences>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <AdditionalLibraryDirectories>\n      </AdditionalLibraryDirectories>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n    <Manifest>\n      <AdditionalManifestFiles>$(SolutionDir)DynamicAudioNormalizerShared\\res\\compat.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>\n    </Manifest>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include</AdditionalIncludeDirectories>\n      <Optimization>MaxSpeed</Optimization>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n    </ClCompile>\n    <Link>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <AdditionalDependencies>\n      </AdditionalDependencies>\n      <SubSystem>Console</SubSystem>\n      <OptimizeReferences>true</OptimizeReferences>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <AdditionalLibraryDirectories>\n      </AdditionalLibraryDirectories>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n    <Manifest>\n      <AdditionalManifestFiles>$(SolutionDir)DynamicAudioNormalizerShared\\res\\compat.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>\n    </Manifest>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include</AdditionalIncludeDirectories>\n      <Optimization>MaxSpeed</Optimization>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <OmitFramePointers>true</OmitFramePointers>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n    </ClCompile>\n    <Link>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <AdditionalDependencies>\n      </AdditionalDependencies>\n      <SubSystem>Console</SubSystem>\n      <OptimizeReferences>true</OptimizeReferences>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <AdditionalLibraryDirectories>\n      </AdditionalLibraryDirectories>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n    <Manifest>\n      <AdditionalManifestFiles>$(SolutionDir)DynamicAudioNormalizerShared\\res\\compat.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>\n    </Manifest>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include</AdditionalIncludeDirectories>\n      <Optimization>MaxSpeed</Optimization>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <OmitFramePointers>true</OmitFramePointers>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <FloatingPointModel>Fast</FloatingPointModel>\n    </ClCompile>\n    <Link>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <AdditionalDependencies>\n      </AdditionalDependencies>\n      <SubSystem>Console</SubSystem>\n      <OptimizeReferences>true</OptimizeReferences>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <AdditionalLibraryDirectories>\n      </AdditionalLibraryDirectories>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n    <Manifest>\n      <AdditionalManifestFiles>$(SolutionDir)DynamicAudioNormalizerShared\\res\\compat.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>\n    </Manifest>\n  </ItemDefinitionGroup>\n  <ItemGroup>\n    <Reference Include=\"System\" />\n    <Reference Include=\"System.Data\" />\n    <Reference Include=\"System.Xml\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\AssemblyInfo.cpp\" />\n    <ClCompile Include=\"src\\DynamicAudioNormalizerNET.cpp\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"src\\DynamicAudioNormalizerNET.h\" />\n    <ClInclude Include=\"src\\resource.h\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\DynamicAudioNormalizerAPI\\DynamicAudioNormalizerAPI_VS2017.vcxproj\">\n      <Project>{376386ee-8268-47e3-a335-7663716e4c60}</Project>\n      <Private>true</Private>\n      <ReferenceOutputAssembly>true</ReferenceOutputAssembly>\n      <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>\n      <LinkLibraryDependencies>true</LinkLibraryDependencies>\n      <UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>\n    </ProjectReference>\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"res\\DynamicAudioNormalizerNET.rc\" />\n  </ItemGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerNET/DynamicAudioNormalizerNET_VS2017.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\AssemblyInfo.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\DynamicAudioNormalizerNET.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"src\\resource.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\DynamicAudioNormalizerNET.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"res\\DynamicAudioNormalizerNET.rc\">\n      <Filter>Resource Files</Filter>\n    </ResourceCompile>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerNET/res/DynamicAudioNormalizerNET.rc",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Library\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This library is free software; you can redistribute it and/or\n// modify it under the terms of the GNU Lesser General Public\n// License as published by the Free Software Foundation; either\n// version 2.1 of the License, or (at your option) any later version.\n//\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public\n// License along with this library; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n//\n// http://www.gnu.org/licenses/lgpl-2.1.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#include \"WinResrc.h\" //\"afxres.h\"\n\n#define INC_DYNAUDNORM_VERSION_INTERNAL 0x22b4f8a9\n#include \"../DynamicAudioNormalizerShared/res/version.inc\"\n\n//////////////////////////////////////////////////////////////////////////////////\n// Neutral resources\n//////////////////////////////////////////////////////////////////////////////////\n\n#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)\n#ifdef _WIN32\nLANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL\n#pragma code_page(1252)\n#endif //_WIN32\n\n//////////////////////////////////////////////////////////////////////////////////\n// Version\n//////////////////////////////////////////////////////////////////////////////////\n\nVS_VERSION_INFO VERSIONINFO\n FILEVERSION    VER_DYNAUDNORM_MAJOR,VER_DYNAUDNORM_MINOR_HI,VER_DYNAUDNORM_MINOR_LO,VER_DYNAUDNORM_PATCH\n PRODUCTVERSION VER_DYNAUDNORM_MAJOR,VER_DYNAUDNORM_MINOR_HI,VER_DYNAUDNORM_MINOR_LO,VER_DYNAUDNORM_PATCH\n FILEFLAGSMASK 0x17L\n#ifdef _DEBUG\n FILEFLAGS 0x3L\n#else\n FILEFLAGS 0x2L\n#endif\n FILEOS 0x40004L\n FILETYPE 0x2L\n FILESUBTYPE 0x0L\nBEGIN\n    BLOCK \"StringFileInfo\"\n    BEGIN\n        BLOCK \"000004b0\"\n        BEGIN\n            VALUE \"Comments\", \"This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License <http://www.gnu.org/>.\"\n            VALUE \"CompanyName\", \"LoRd_MuldeR <mulder2@gmx.de>\"\n            VALUE \"FileDescription\", \"DynamicAudioNormalizer .NET Wrapper\"\n            VALUE \"FileVersion\", VER_DYNAUDNORM_STR\n            VALUE \"InternalName\", \"DynamicAudioNormalizerNET\"\n            VALUE \"LegalCopyright\", \"Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>\"\n            VALUE \"LegalTrademarks\", \"This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License <http://www.gnu.org/>\"\n            VALUE \"OriginalFilename\", \"DynamicAudioNormalizerNET.dll\"\n            VALUE \"ProductName\", \"DynamicAudioNormalizer\"\n            VALUE \"ProductVersion\", VER_DYNAUDNORM_STR\n        END\n    END\n    BLOCK \"VarFileInfo\"\n    BEGIN\n        VALUE \"Translation\", 0x0, 1200\n    END\nEND\n\n#endif    // Neutral resources\n"
  },
  {
    "path": "DynamicAudioNormalizerNET/samples/DynamicAudioNormalizerExample.cs",
    "content": "﻿//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Microsoft.NET Wrapper\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n// http://opensource.org/licenses/MIT\n//////////////////////////////////////////////////////////////////////////////////\n\nusing System;\nusing System.IO;\nusing System.Reflection;\n\nusing DynamicAudioNormalizer;\n\nnamespace DynamicAudioNormalizer_Example\n{\n    class SampleReader : IDisposable\n    {\n        public SampleReader(String fileName)\n        {\n            m_reader = new BinaryReader(File.OpenRead(fileName));\n        }\n\n        public int read(double[,] samplesOut)\n        {\n            int channels   = samplesOut.GetLength(0);\n            int maxSamples = samplesOut.GetLength(1);\n\n            for (int i = 0; i < maxSamples; i++)\n            {\n                for (int c = 0; c < channels; c++)\n                {\n                    try\n                    {\n                        samplesOut[c, i] = (double) m_reader.ReadInt16() / 32767.0;\n                    }\n                    catch(EndOfStreamException)\n                    {\n                        return i;\n                    }\n                }\n            }\n\n            return maxSamples;\n        }\n\n        public void Dispose()\n        {\n            m_reader.Dispose();\n        }\n\n        private readonly BinaryReader m_reader;\n    }\n\n    class SampleWriter : IDisposable\n    {\n        public SampleWriter(String fileName)\n        {\n            m_writer = new BinaryWriter(File.OpenWrite(fileName));\n        }\n\n        public void write(double[,] samplesIn, int sampleCount)\n        {\n            int channels = samplesIn.GetLength(0);\n\n            for (int i = 0; i < sampleCount; i++)\n            {\n                for (int c = 0; c < channels; c++)\n                {\n                    m_writer.Write((short)(samplesIn[c, i] * 32767.0));\n                }\n            }\n        }\n\n        public void Dispose()\n        {\n            m_writer.Dispose();\n        }\n\n        private readonly BinaryWriter m_writer;\n    }\n\n    class Program\n    {\n        static void Main(string[] args)\n        {\n            try\n            {\n                String version = Assembly.GetExecutingAssembly().GetName().Version.ToString();\n                Console.WriteLine(\"DynamicAudioNormalizer.NET C# Example [{0}]\\n\", version);\n                runTest();\n                GC.WaitForPendingFinalizers();\n            }\n            catch (Exception e)\n            {\n                Console.WriteLine(\"\\nFAILURE!!!\\n\\n\" + e.GetType() + \": \" + e.Message + \"\\n\");\n            }\n        }\n\n        private static void runTest()\n        {\n            uint major, minor, patch;\n            DynamicAudioNormalizerNET.getVersionInfo(out major, out minor, out patch);\n            Console.WriteLine(\"Library Version {0}.{1}-{2}\", major.ToString(), minor.ToString(\"D2\"), minor, patch.ToString());\n\n            String date, time, compiler, arch; bool debug;\n            DynamicAudioNormalizerNET.getBuildInfo(out date, out time, out compiler, out arch, out debug);\n            Console.WriteLine(\"Date: {0}, Time: {1}, Compiler: {2}, Arch: {3}, {4}\", date, time, compiler, arch, debug ? \"DEBUG\" : \"Release\");\n\n            DynamicAudioNormalizerNET.setLogger(delegate(int level, String message)\n            {\n                switch (level)\n                {\n                    case  0: Console.WriteLine(\"[DynAudNorm][DBG] \" + message); break;\n                    case  1: Console.WriteLine(\"[DynAudNorm][WRN] \" + message); break;\n                    case  2: Console.WriteLine(\"[DynAudNorm][ERR] \" + message); break;\n                    default: Console.WriteLine(\"[DynAudNorm][???] \" + message); break;\n                }\n            });\n\n            using(DynamicAudioNormalizerNET instance = new DynamicAudioNormalizerNET(2, 44100, 500, 31, 0.95, 10.0, 0.0, 0.0, true, false, false))\n            {\n                using (SampleReader reader = new SampleReader(\"Input.pcm\"))\n                {\n                    using (SampleWriter writer = new SampleWriter(\"Output.pcm\"))\n                    {\n                        uint channels, sampleRate, frameLen, filterSize;\n                        instance.getConfiguration(out channels, out sampleRate, out frameLen, out filterSize);\n                        Console.WriteLine(\"channels: \" + channels.ToString());\n                        Console.WriteLine(\"sampleRate: \" + sampleRate.ToString());\n                        Console.WriteLine(\"frameLen: \" + frameLen.ToString());\n                        Console.WriteLine(\"filterSize: \" + filterSize.ToString());\n\n                        long internalDelay = instance.getInternalDelay();\n                        Console.WriteLine(\"internalDelay: \" + internalDelay.ToString());\n\n                        process(reader, writer, instance);\n                    }\n                }\n            }\n        }\n\n        private static void process(SampleReader reader, SampleWriter writer, DynamicAudioNormalizerNET instance)\n        {\n            double[,] data = new double[2, 4096];\n\n            Console.WriteLine(\"Processing audio samples in-place...\");\n            for(;;)\n            {\n                int inputSamples = reader.read(data);\n                if(inputSamples > 0)\n                {\n                    int outputSamples = (int)instance.processInplace(data, inputSamples);\n                    if(outputSamples > 0)\n                    {\n                        writer.write(data, outputSamples);\n                    }\n                }\n                if(inputSamples < data.GetLength(1))\n                {\n                    break; /*EOF*/\n                }\n            }\n\n            Console.WriteLine(\"Flushing remaining samples from buffer...\");\n            for(;;)\n            {\n                int outputSamples = (int) instance.flushBuffer(data);\n                if (outputSamples > 0)\n                {\n                    writer.write(data, outputSamples);\n                }\n                if (outputSamples < 1)\n                {\n                    break; /*EOF*/\n                }\n            }\n\n            Console.WriteLine(\"Resetting the normalizer instance...\");\n            instance.reset(); //Just for testing, this NOT actually required here!\n\n            Console.WriteLine(\"Finished.\");\n        }\n    }\n}\n"
  },
  {
    "path": "DynamicAudioNormalizerNET/samples/DynamicAudioNormalizerExample.vb",
    "content": "﻿REM //////////////////////////////////////////////////////////////////////////////////\nREM // Dynamic Audio Normalizer - Microsoft.NET Wrapper\nREM // Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\nREM //\nREM // Permission is hereby granted, free of charge, to any person obtaining a copy\nREM // of this software and associated documentation files (the \"Software\"), to deal\nREM // in the Software without restriction, including without limitation the rights\nREM // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\nREM // copies of the Software, and to permit persons to whom the Software is\nREM // furnished to do so, subject to the following conditions:\nREM //\nREM // The above copyright notice and this permission notice shall be included in\nREM // all copies or substantial portions of the Software.\nREM //\nREM // THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nREM // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nREM // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nREM // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nREM // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nREM // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nREM // THE SOFTWARE.\nREM //\nREM // http://opensource.org/licenses/MIT\nREM //////////////////////////////////////////////////////////////////////////////////\n\nImports System.Reflection\nImports DynamicAudioNormalizer\n\nModule DynamicAudioNormalizerExample\n\n    REM --------------------------------------------------------------------------\n    REM AudioFileReader Class\n    REM --------------------------------------------------------------------------\n    Class AudioFileReader\n        Implements IDisposable\n        Private Reader As IO.BinaryReader\n\n        Public Sub New(FileName As String)\n            Reader = New IO.BinaryReader(IO.File.OpenRead(FileName))\n        End Sub\n\n        Protected Sub Dispose() Implements IDisposable.Dispose\n            If Reader IsNot Nothing Then\n                Reader.Dispose()\n            End If\n        End Sub\n\n        Public Function Read(SamplesOut(,) As Double) As Long\n            Dim Channels As Integer = SamplesOut.GetLength(0)\n            Dim MaxSamples As Integer = SamplesOut.GetLength(1)\n            For I As Long = 0 To MaxSamples - 1\n                For C As Long = 0 To Channels - 1\n                    Try\n                        SamplesOut(C, I) = CType(Reader.ReadInt16(), Double) / 32767.0\n                    Catch E As IO.EndOfStreamException\n                        Return I\n                    End Try\n                Next\n            Next\n            Return MaxSamples\n        End Function\n    End Class\n\n    REM --------------------------------------------------------------------------\n    REM AudioFileWriter Class\n    REM --------------------------------------------------------------------------\n    Class AudioFileWriter\n        Implements IDisposable\n        Private Writer As IO.BinaryWriter\n\n        Public Sub New(FileName As String)\n            Writer = New IO.BinaryWriter(IO.File.OpenWrite(FileName))\n        End Sub\n\n        Protected Sub Dispose() Implements IDisposable.Dispose\n            If Writer IsNot Nothing Then\n                Writer.Flush()\n                Writer.Dispose()\n            End If\n        End Sub\n\n        Public Sub Write(SamplesOut(,) As Double, SampleCount As Long)\n            Dim Channels As Integer = SamplesOut.GetLength(0)\n            For I As Long = 0 To SampleCount - 1\n                For C As Long = 0 To Channels - 1\n                    Writer.Write(CType(SamplesOut(C, I) * 32767.0, Short))\n                Next\n            Next\n        End Sub\n    End Class\n\n    REM --------------------------------------------------------------------------\n    REM Logging Callback\n    REM --------------------------------------------------------------------------\n    Private Sub LoggingHandler(Level As Int32, Message As String)\n        Select Case Level\n            Case 0\n                Console.WriteLine(\"[DynAudNorm][DBG] \" & Message)\n            Case 1\n                Console.WriteLine(\"[DynAudNorm][WRN] \" & Message)\n            Case 2\n                Console.WriteLine(\"[DynAudNorm][ERR] \" & Message)\n            Case Else\n                Console.WriteLine(\"[DynAudNorm][???] \" & Message)\n        End Select\n    End Sub\n\n    REM --------------------------------------------------------------------------\n    REM Main Function\n    REM --------------------------------------------------------------------------\n    Sub Main()\n        Dim Version As String\n        Version = Assembly.GetExecutingAssembly().GetName().Version.ToString()\n        Console.WriteLine(\"DynamicAudioNormalizer.NET VisualBasic Example [\" & Version & \"]\" & vbCrLf)\n\n        Try\n            DynamicAudioNormalizerNET.setLogger(AddressOf LoggingHandler)\n\n            Dim MajorVer As UInteger = 0, MinorVer As UInteger = 0, PatchVer As UInteger = 0\n            DynamicAudioNormalizerNET.getVersionInfo(MajorVer, MinorVer, PatchVer)\n            Console.WriteLine(\"Library Version: \" & MajorVer & \".\" & Format(MinorVer, \"##00\") & \"-\" & PatchVer)\n\n            Dim DateStr As String = \"\", TimeStr As String = \"\", CompilerStr As String = \"\", ArchStr As String = \"\", IsDebug As Boolean = False\n            DynamicAudioNormalizerNET.getBuildInfo(DateStr, TimeStr, CompilerStr, ArchStr, IsDebug)\n            Console.WriteLine(\"Library Build Date: \" & DateStr)\n            Console.WriteLine(\"Library Build Time: \" & TimeStr)\n            Console.WriteLine(\"Library Compiler: \" & CompilerStr & \" (\" & ArchStr & \")\")\n            Console.WriteLine(\"Library Is Debug: \" & IsDebug)\n\n            Using Reader = New AudioFileReader(\"Input.pcm\")\n                Using Writer = New AudioFileWriter(\"Output.pcm\")\n                    Using Instance = New DynamicAudioNormalizerNET(2, 44100, 500, 31, 0.95, 10.0, 0.0, 0.0, True, False, False)\n                        ProcessAudioFile(Instance, Reader, Writer)\n                    End Using\n                End Using\n            End Using\n\n            Console.WriteLine(\"Test completed.\" & vbCrLf)\n        Catch Except As Exception\n            Console.WriteLine(vbCrLf & \"FAILURE !!!\")\n            Console.WriteLine(vbCrLf & Except.GetType().ToString() & \": \" & Except.Message & vbCrLf)\n        End Try\n    End Sub\n\n    REM --------------------------------------------------------------------------\n    REM Processing Loop\n    REM --------------------------------------------------------------------------\n    Private Sub ProcessAudioFile(Instance As DynamicAudioNormalizerNET, Reader As AudioFileReader, Writer As AudioFileWriter)\n        Dim Channels As UInteger = 0, FilterSize As UInteger = 0, FrameLen As UInteger = 0, SampleRate As UInteger = 0\n        Instance.getConfiguration(Channels, FilterSize, FrameLen, SampleRate)\n        Console.WriteLine(\"Channels: \" & Channels)\n        Console.WriteLine(\"FilterSize: \" & FilterSize)\n        Console.WriteLine(\"FrameLen: \" & FrameLen)\n        Console.WriteLine(\"SampleRate: \" & SampleRate)\n\n        Dim InternalDelay As Long = Instance.getInternalDelay()\n        Console.WriteLine(\"InternalDelay: \" & InternalDelay)\n\n        REM Note: VisualBasic specifies the highest index value (i.e. Length - 1) rather than the Length, so the following creates a 2 x 4096 array!\n        Dim AudioSamples = New Double(Channels - 1, 4095) {}\n\n        Console.WriteLine(\"Processing audio samples, please wait...\")\n        While True\n            Dim InputSamples = Reader.Read(AudioSamples)\n            If InputSamples > 0 Then\n                Dim OutputSamples = Instance.processInplace(AudioSamples, InputSamples)\n                If OutputSamples > 0 Then\n                    Writer.Write(AudioSamples, OutputSamples)\n                End If\n            End If\n            If InputSamples < AudioSamples.GetLength(1) Then\n                REM End of file reached!\n                Exit While\n            End If\n        End While\n\n        Console.WriteLine(\"Flushing buffer, please wait...\")\n        While True\n            Dim OutputSamples = Instance.flushBuffer(AudioSamples)\n            If OutputSamples > 0 Then\n                Writer.Write(AudioSamples, OutputSamples)\n                Continue While\n            End If\n            REM No more samples to flush!\n            Exit While\n        End While\n\n        REM Only for testing, not usually required!\n        Instance.reset()\n    End Sub\n\nEnd Module\n"
  },
  {
    "path": "DynamicAudioNormalizerNET/samples/DynamicAudioNormalizerExample_CS.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"12.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <Import Project=\"$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\" Condition=\"Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')\" />\n  <PropertyGroup>\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\n    <ProjectGuid>{AC5A5448-A96E-492C-AC9C-81986F418BBB}</ProjectGuid>\n    <OutputType>Exe</OutputType>\n    <AppDesignerFolder>Properties</AppDesignerFolder>\n    <RootNamespace>DynamicAudioNormalizerExample_CS</RootNamespace>\n    <AssemblyName>DynamicAudioNormalizerExample_CS</AssemblyName>\n    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>\n    <FileAlignment>512</FileAlignment>\n    <PublishUrl>publish\\</PublishUrl>\n    <Install>true</Install>\n    <InstallFrom>Disk</InstallFrom>\n    <UpdateEnabled>false</UpdateEnabled>\n    <UpdateMode>Foreground</UpdateMode>\n    <UpdateInterval>7</UpdateInterval>\n    <UpdateIntervalUnits>Days</UpdateIntervalUnits>\n    <UpdatePeriodically>false</UpdatePeriodically>\n    <UpdateRequired>false</UpdateRequired>\n    <MapFileExtensions>true</MapFileExtensions>\n    <ApplicationRevision>0</ApplicationRevision>\n    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>\n    <IsWebBootstrapper>false</IsWebBootstrapper>\n    <UseApplicationTrust>false</UseApplicationTrust>\n    <BootstrapperEnabled>true</BootstrapperEnabled>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)' == 'Debug|x86'\">\n    <DebugSymbols>true</DebugSymbols>\n    <OutputPath>bin\\x86\\Debug\\</OutputPath>\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\n    <DebugType>full</DebugType>\n    <PlatformTarget>x86</PlatformTarget>\n    <ErrorReport>prompt</ErrorReport>\n    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)' == 'Release|x86'\">\n    <OutputPath>bin\\x86\\Release\\</OutputPath>\n    <DefineConstants>TRACE</DefineConstants>\n    <Optimize>true</Optimize>\n    <DebugType>pdbonly</DebugType>\n    <PlatformTarget>x86</PlatformTarget>\n    <ErrorReport>prompt</ErrorReport>\n    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>\n  </PropertyGroup>\n  <PropertyGroup>\n    <StartupObject>DynamicAudioNormalizer_Example.Program</StartupObject>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)' == 'Debug|x64'\">\n    <DebugSymbols>true</DebugSymbols>\n    <OutputPath>bin\\x64\\Debug\\</OutputPath>\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\n    <DebugType>full</DebugType>\n    <PlatformTarget>x64</PlatformTarget>\n    <ErrorReport>prompt</ErrorReport>\n    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)' == 'Release|x64'\">\n    <OutputPath>bin\\x64\\Release\\</OutputPath>\n    <DefineConstants>TRACE</DefineConstants>\n    <Optimize>true</Optimize>\n    <DebugType>pdbonly</DebugType>\n    <PlatformTarget>x64</PlatformTarget>\n    <ErrorReport>prompt</ErrorReport>\n    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>\n  </PropertyGroup>\n  <ItemGroup>\n    <Reference Include=\"DynamicAudioNormalizerNET, Version=1.0.5410.34124, Culture=neutral, processorArchitecture=x86\">\n      <SpecificVersion>False</SpecificVersion>\n      <HintPath>..\\..\\bin\\Win32\\v140_xp\\Release_DLL\\DynamicAudioNormalizerNET.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System\" />\n    <Reference Include=\"System.Core\" />\n    <Reference Include=\"System.Xml.Linq\" />\n    <Reference Include=\"System.Data.DataSetExtensions\" />\n    <Reference Include=\"Microsoft.CSharp\" />\n    <Reference Include=\"System.Data\" />\n    <Reference Include=\"System.Xml\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Compile Include=\"DynamicAudioNormalizerExample.cs\" />\n    <Compile Include=\"Properties\\AssemblyInfo.cs\" />\n  </ItemGroup>\n  <ItemGroup>\n    <BootstrapperPackage Include=\".NETFramework,Version=v4.0\">\n      <Visible>False</Visible>\n      <ProductName>Microsoft .NET Framework 4 %28x86 and x64%29</ProductName>\n      <Install>true</Install>\n    </BootstrapperPackage>\n    <BootstrapperPackage Include=\"Microsoft.Net.Client.3.5\">\n      <Visible>False</Visible>\n      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>\n      <Install>false</Install>\n    </BootstrapperPackage>\n    <BootstrapperPackage Include=\"Microsoft.Net.Framework.3.5.SP1\">\n      <Visible>False</Visible>\n      <ProductName>.NET Framework 3.5 SP1</ProductName>\n      <Install>false</Install>\n    </BootstrapperPackage>\n    <BootstrapperPackage Include=\"Microsoft.Windows.Installer.4.5\">\n      <Visible>False</Visible>\n      <ProductName>Windows Installer 4.5</ProductName>\n      <Install>true</Install>\n    </BootstrapperPackage>\n  </ItemGroup>\n  <Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\n  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \n       Other similar extension points exist, see Microsoft.Common.targets.\n  <Target Name=\"BeforeBuild\">\n  </Target>\n  <Target Name=\"AfterBuild\">\n  </Target>\n  -->\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerNET/samples/DynamicAudioNormalizerExample_VB.vbproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"12.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <Import Project=\"$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\" Condition=\"Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')\" />\n  <PropertyGroup>\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\n    <ProjectGuid>{07C91D94-3626-46D4-8CAA-4A1548CEAAAE}</ProjectGuid>\n    <OutputType>Exe</OutputType>\n    <StartupObject>DynamicAudioNormalizerExample_VB.DynamicAudioNormalizerExample</StartupObject>\n    <RootNamespace>DynamicAudioNormalizerExample_VB</RootNamespace>\n    <AssemblyName>DynamicAudioNormalizerExample_VB</AssemblyName>\n    <FileAlignment>512</FileAlignment>\n    <MyType>Console</MyType>\n    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>\n    <PublishUrl>publish\\</PublishUrl>\n    <Install>true</Install>\n    <InstallFrom>Disk</InstallFrom>\n    <UpdateEnabled>false</UpdateEnabled>\n    <UpdateMode>Foreground</UpdateMode>\n    <UpdateInterval>7</UpdateInterval>\n    <UpdateIntervalUnits>Days</UpdateIntervalUnits>\n    <UpdatePeriodically>false</UpdatePeriodically>\n    <UpdateRequired>false</UpdateRequired>\n    <MapFileExtensions>true</MapFileExtensions>\n    <ApplicationRevision>0</ApplicationRevision>\n    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>\n    <IsWebBootstrapper>false</IsWebBootstrapper>\n    <UseApplicationTrust>false</UseApplicationTrust>\n    <BootstrapperEnabled>true</BootstrapperEnabled>\n  </PropertyGroup>\n  <PropertyGroup>\n    <OptionExplicit>On</OptionExplicit>\n  </PropertyGroup>\n  <PropertyGroup>\n    <OptionCompare>Binary</OptionCompare>\n  </PropertyGroup>\n  <PropertyGroup>\n    <OptionStrict>Off</OptionStrict>\n  </PropertyGroup>\n  <PropertyGroup>\n    <OptionInfer>On</OptionInfer>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)' == 'Debug|x86'\">\n    <DebugSymbols>true</DebugSymbols>\n    <DefineDebug>true</DefineDebug>\n    <DefineTrace>true</DefineTrace>\n    <OutputPath>bin\\x86\\Debug\\</OutputPath>\n    <DocumentationFile>DynamicAudioNormalizerExample_VB.xml</DocumentationFile>\n    <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>\n    <DebugType>full</DebugType>\n    <PlatformTarget>x86</PlatformTarget>\n    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)' == 'Release|x86'\">\n    <DefineTrace>true</DefineTrace>\n    <OutputPath>bin\\x86\\Release\\</OutputPath>\n    <DocumentationFile>DynamicAudioNormalizerExample_VB.xml</DocumentationFile>\n    <Optimize>true</Optimize>\n    <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>\n    <DebugType>pdbonly</DebugType>\n    <PlatformTarget>x86</PlatformTarget>\n    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)' == 'Debug|x64'\">\n    <DebugSymbols>true</DebugSymbols>\n    <DefineDebug>true</DefineDebug>\n    <DefineTrace>true</DefineTrace>\n    <OutputPath>bin\\x64\\Debug\\</OutputPath>\n    <DocumentationFile>DynamicAudioNormalizerExample_VB.xml</DocumentationFile>\n    <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>\n    <DebugType>full</DebugType>\n    <PlatformTarget>x64</PlatformTarget>\n    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)' == 'Release|x64'\">\n    <DefineTrace>true</DefineTrace>\n    <OutputPath>bin\\x64\\Release\\</OutputPath>\n    <DocumentationFile>DynamicAudioNormalizerExample_VB.xml</DocumentationFile>\n    <Optimize>true</Optimize>\n    <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>\n    <DebugType>pdbonly</DebugType>\n    <PlatformTarget>x64</PlatformTarget>\n    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>\n  </PropertyGroup>\n  <ItemGroup>\n    <Reference Include=\"DynamicAudioNormalizerNET\">\n      <HintPath>..\\..\\bin\\Win32\\v140_xp\\Release_DLL\\DynamicAudioNormalizerNET.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System\" />\n    <Reference Include=\"System.Data\" />\n    <Reference Include=\"System.Deployment\" />\n    <Reference Include=\"System.Xml\" />\n    <Reference Include=\"System.Core\" />\n    <Reference Include=\"System.Xml.Linq\" />\n    <Reference Include=\"System.Data.DataSetExtensions\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Import Include=\"Microsoft.VisualBasic\" />\n    <Import Include=\"System\" />\n    <Import Include=\"System.Collections\" />\n    <Import Include=\"System.Collections.Generic\" />\n    <Import Include=\"System.Data\" />\n    <Import Include=\"System.Diagnostics\" />\n    <Import Include=\"System.Linq\" />\n    <Import Include=\"System.Xml.Linq\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Compile Include=\"Properties\\AssemblyInfo.vb\" />\n    <Compile Include=\"DynamicAudioNormalizerExample.vb\" />\n  </ItemGroup>\n  <ItemGroup>\n    <BootstrapperPackage Include=\".NETFramework,Version=v4.0\">\n      <Visible>False</Visible>\n      <ProductName>Microsoft .NET Framework 4 %28x86 and x64%29</ProductName>\n      <Install>true</Install>\n    </BootstrapperPackage>\n    <BootstrapperPackage Include=\"Microsoft.Net.Client.3.5\">\n      <Visible>False</Visible>\n      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>\n      <Install>false</Install>\n    </BootstrapperPackage>\n    <BootstrapperPackage Include=\"Microsoft.Net.Framework.3.5.SP1\">\n      <Visible>False</Visible>\n      <ProductName>.NET Framework 3.5 SP1</ProductName>\n      <Install>false</Install>\n    </BootstrapperPackage>\n    <BootstrapperPackage Include=\"Microsoft.Windows.Installer.4.5\">\n      <Visible>False</Visible>\n      <ProductName>Windows Installer 4.5</ProductName>\n      <Install>true</Install>\n    </BootstrapperPackage>\n  </ItemGroup>\n  <ItemGroup>\n    <Folder Include=\"My Project\\\" />\n  </ItemGroup>\n  <Import Project=\"$(MSBuildToolsPath)\\Microsoft.VisualBasic.targets\" />\n  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \n       Other similar extension points exist, see Microsoft.Common.targets.\n  <Target Name=\"BeforeBuild\">\n  </Target>\n  <Target Name=\"AfterBuild\">\n  </Target>\n  -->\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerNET/samples/DynamicAudioNormalizerExamples.sln",
    "content": "﻿\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.25420.1\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"DynamicAudioNormalizerExample_CS\", \"DynamicAudioNormalizerExample_CS.csproj\", \"{AC5A5448-A96E-492C-AC9C-81986F418BBB}\"\nEndProject\nProject(\"{F184B08F-C81C-45F6-A57F-5ABD9991F28F}\") = \"DynamicAudioNormalizerExample_VB\", \"DynamicAudioNormalizerExample_VB.vbproj\", \"{07C91D94-3626-46D4-8CAA-4A1548CEAAAE}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|x64 = Debug|x64\n\t\tDebug|x86 = Debug|x86\n\t\tRelease|x64 = Release|x64\n\t\tRelease|x86 = Release|x86\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{AC5A5448-A96E-492C-AC9C-81986F418BBB}.Debug|x64.ActiveCfg = Debug|x64\n\t\t{AC5A5448-A96E-492C-AC9C-81986F418BBB}.Debug|x64.Build.0 = Debug|x64\n\t\t{AC5A5448-A96E-492C-AC9C-81986F418BBB}.Debug|x86.ActiveCfg = Debug|x86\n\t\t{AC5A5448-A96E-492C-AC9C-81986F418BBB}.Debug|x86.Build.0 = Debug|x86\n\t\t{AC5A5448-A96E-492C-AC9C-81986F418BBB}.Release|x64.ActiveCfg = Release|x64\n\t\t{AC5A5448-A96E-492C-AC9C-81986F418BBB}.Release|x64.Build.0 = Release|x64\n\t\t{AC5A5448-A96E-492C-AC9C-81986F418BBB}.Release|x86.ActiveCfg = Release|x86\n\t\t{AC5A5448-A96E-492C-AC9C-81986F418BBB}.Release|x86.Build.0 = Release|x86\n\t\t{07C91D94-3626-46D4-8CAA-4A1548CEAAAE}.Debug|x64.ActiveCfg = Debug|x64\n\t\t{07C91D94-3626-46D4-8CAA-4A1548CEAAAE}.Debug|x86.ActiveCfg = Debug|x64\n\t\t{07C91D94-3626-46D4-8CAA-4A1548CEAAAE}.Release|x64.ActiveCfg = Release|x64\n\t\t{07C91D94-3626-46D4-8CAA-4A1548CEAAAE}.Release|x64.Build.0 = Release|x64\n\t\t{07C91D94-3626-46D4-8CAA-4A1548CEAAAE}.Release|x86.ActiveCfg = Release|x86\n\t\t{07C91D94-3626-46D4-8CAA-4A1548CEAAAE}.Release|x86.Build.0 = Release|x86\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n"
  },
  {
    "path": "DynamicAudioNormalizerNET/samples/Properties/AssemblyInfo.cs",
    "content": "﻿using System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n// General Information about an assembly is controlled through the following \n// set of attributes. Change these attribute values to modify the information\n// associated with an assembly.\n[assembly: AssemblyTitle(\"DynamicAudioNormalizer.NET Example\")]\n[assembly: AssemblyDescription(\"DynamicAudioNormalizer.NET Example\")]\n[assembly: AssemblyConfiguration(\"\")]\n[assembly: AssemblyCompany(\"FSF\")]\n[assembly: AssemblyProduct(\"DynamicAudioNormalizer.NET\")]\n[assembly: AssemblyCopyright(\"Copyright © 2014-2019 LoRd_MuldeR <mulder2@gmx.de>\")]\n[assembly: AssemblyTrademark(\"\")]\n[assembly: AssemblyCulture(\"\")]\n\n// Setting ComVisible to false makes the types in this assembly not visible \n// to COM components.  If you need to access a type in this assembly from \n// COM, set the ComVisible attribute to true on that type.\n[assembly: ComVisible(false)]\n\n// The following GUID is for the ID of the typelib if this project is exposed to COM\n[assembly: Guid(\"1e292d70-b972-463a-a55c-9274dfa9ffeb\")]\n\n// Version information for an assembly consists of the following four values:\n//\n//      Major Version\n//      Minor Version \n//      Build Number\n//      Revision\n//\n// You can specify all the values or you can default the Build and Revision Numbers \n// by using the '*' as shown below:\n// [assembly: AssemblyVersion(\"1.0.*\")]\n[assembly: AssemblyVersion(\"1.0.0.0\")]\n[assembly: AssemblyFileVersion(\"1.0.0.0\")]\n"
  },
  {
    "path": "DynamicAudioNormalizerNET/samples/Properties/AssemblyInfo.vb",
    "content": "﻿Imports System\nImports System.Reflection\nImports System.Runtime.InteropServices\n\n' General Information about an assembly is controlled through the following \n' set of attributes. Change these attribute values to modify the information\n' associated with an assembly.\n\n' Review the values of the assembly attributes\n\n<Assembly: AssemblyTitle(\"DynamicAudioNormalizerNET_Example_VB\")> \n<Assembly: AssemblyDescription(\"\")> \n<Assembly: AssemblyCompany(\"\")> \n<Assembly: AssemblyProduct(\"\")> \n<Assembly: AssemblyCopyright(\"Copyright © 2014-2019 LoRd_MuldeR <mulder2@gmx.de>\")> \n<Assembly: AssemblyTrademark(\"\")> \n\n<Assembly: ComVisible(False)> \n\n'The following GUID is for the ID of the typelib if this project is exposed to COM\n<Assembly: Guid(\"1fb177a1-2b48-4330-943c-f7603cf2f480\")> \n\n' Version information for an assembly consists of the following four values:\n'\n'      Major Version\n'      Minor Version \n'      Build Number\n'      Revision\n'\n' You can specify all the values or you can default the Build and Revision Numbers \n' by using the '*' as shown below:\n\n<Assembly: AssemblyVersion(\"1.0.0.0\")> \n<Assembly: AssemblyFileVersion(\"1.0.0.0\")> \n"
  },
  {
    "path": "DynamicAudioNormalizerNET/src/AssemblyInfo.cpp",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Microsoft.NET Wrapper\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n// http://opensource.org/licenses/MIT\n//////////////////////////////////////////////////////////////////////////////////\n\nusing namespace System;\nusing namespace System::Reflection;\nusing namespace System::Runtime::CompilerServices;\nusing namespace System::Runtime::InteropServices;\nusing namespace System::Security::Permissions;\n\n#include <DynamicAudioNormalizer.h>\n\n#define CORE_VERSION_MAKE_STR1(X) #X\n#define CORE_VERSION_MAKE_STR2(X) CORE_VERSION_MAKE_STR1(X)\n#define CORE_VERSION CORE_VERSION_MAKE_STR2(MDYNAMICAUDIONORMALIZER_CORE)\n\n//\n// General Information about an assembly is controlled through the following\n// set of attributes. Change these attribute values to modify the information\n// associated with an assembly.\n//\n[assembly:AssemblyTitleAttribute(L\"DynamicAudioNormalizerNET\")];\n[assembly:AssemblyDescriptionAttribute(L\"DynamicAudioNormalizer .NET-Wrapper\")];\n[assembly:AssemblyConfigurationAttribute(L\"\")];\n[assembly:AssemblyCompanyAttribute(L\"Free Software Foundation\")];\n[assembly:AssemblyProductAttribute(L\"DynamicAudioNormalizerNET\")];\n[assembly:AssemblyCopyrightAttribute(L\"Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>\")];\n[assembly:AssemblyTrademarkAttribute(L\"\")];\n[assembly:AssemblyCultureAttribute(L\"\")];\n\n//\n// Version information for an assembly consists of the following four values:\n//\n//      Major Version\n//      Minor Version\n//      Build Number\n//      Revision\n//\n// You can specify all the value or you can default the Revision and Build Numbers\n// by using the '*' as shown below:\n//\n[assembly:AssemblyVersionAttribute(CORE_VERSION \".0.*\")];\n\n[assembly:ComVisible(false)];\n\n[assembly:CLSCompliantAttribute(true)];"
  },
  {
    "path": "DynamicAudioNormalizerNET/src/DynamicAudioNormalizerNET.cpp",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Microsoft.NET Wrapper\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n// http://opensource.org/licenses/MIT\n//////////////////////////////////////////////////////////////////////////////////\n\n#include \"DynamicAudioNormalizerNET.h\"\n\n#include <stdexcept>\n#include <vector>\n#include <Common.h>\n\nusing namespace System::Threading;\n\n///////////////////////////////////////////////////////////////////////////////\n// Helper Functions\n///////////////////////////////////////////////////////////////////////////////\n\ntemplate<class T>\nstatic void INIT_ARRAY_2D(T *basePtr, T **outPtr, const int64_t dimOuter , const int64_t dimInner)\n{\n\tfor(int64_t i = 0; i < dimOuter; i++)\n\t{\n\t\toutPtr[i] = basePtr;\n\t\tbasePtr += dimInner;\n\t}\n}\n\n#define PIN_ARRAY_2D(ARRAY, TYPE) \\\n\tconst int64_t ARRAY##_dimOuter = ARRAY->GetLongLength(0); \\\n\tconst int64_t ARRAY##_dimInner = ARRAY->GetLongLength(1); \\\n\tTYPE **ARRAY##_ptr = (TYPE**) alloca(sizeof(TYPE*) * ((size_t) ARRAY##_dimOuter)); \\\n\tpin_ptr<TYPE> ARRAY##_pinned = &ARRAY[0,0]; \\\n\tINIT_ARRAY_2D<TYPE>(ARRAY##_pinned, ARRAY##_ptr, ARRAY##_dimOuter, ARRAY##_dimInner)\n\n#define TRY_CATCH(FUNC, ...) do \\\n{ \\\n\ttry \\\n\t{ \\\n\t\treturn p_##FUNC(__VA_ARGS__); \\\n\t} \\\n\tcatch(...) \\\n\t{ \\\n\t\tthrow gcnew DynamicAudioNormalizer::DynamicAudioNormalizerNET_Error(\"Unhandeled exception in native MDynamicAudioNormalizer function!\"); \\\n\t} \\\n} \\\nwhile(0)\n\n#define TRY_CATCH_NORET(FUNC, ...) do \\\n{ \\\n\ttry \\\n\t{ \\\n\t\tp_##FUNC(__VA_ARGS__); \\\n\t} \\\n\tcatch(...) \\\n\t{ \\\n\t\tthrow gcnew DynamicAudioNormalizer::DynamicAudioNormalizerNET_Error(\"Unhandeled exception in native MDynamicAudioNormalizer function!\"); \\\n\t} \\\n} \\\nwhile(0)\n\n///////////////////////////////////////////////////////////////////////////////\n// Logging Functions\n///////////////////////////////////////////////////////////////////////////////\n\nnamespace DynamicAudioNormalizer\n{\n\tprivate ref class Lock\n\t{\n\tpublic:\n\t\tLock(Object ^ object)\n\t\t:\n\t\t\tm_object(object)\n\t\t{\n\t\t\tMonitor::Enter(m_object);\n\t\t}\n\n\t\t~Lock()\n\t\t{\n\t\t\tMonitor::Exit(m_object);\n\t\t}\n\n\tprivate:\n\t\tObject ^m_object;\n\t};\n\n\tprivate ref class LoggingSupport\n\t{\n\tpublic:\n\t\tstatic void log(const int &logLevel, const char *const message)\n\t\t{\n\t\t\tLock lock(m_mutex);\n\t\t\tif(m_handler != nullptr)\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tm_handler->Invoke(logLevel, gcnew String(message));\n\t\t\t\t}\n\t\t\t\tcatch(...)\n\t\t\t\t{\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tstatic void setHandler(DynamicAudioNormalizerNET_Logger ^handler)\n\t\t{\n\t\t\tLock lock(m_mutex);\n\t\t\tm_handler = handler;\n\t\t}\n\n\tprivate:\n\t\tstatic DynamicAudioNormalizerNET_Logger ^m_handler = nullptr;\n\t\tstatic Object^ m_mutex = gcnew Object();\n\t};\n}\n\nstatic void dotNetLoggingHandler(const int logLevel, const char *const message)\n{\n\tDynamicAudioNormalizer::LoggingSupport::log(logLevel, message);\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Static Functions\n///////////////////////////////////////////////////////////////////////////////\n\nvoid DynamicAudioNormalizer::DynamicAudioNormalizerNET::setLogger(DynamicAudioNormalizerNET_Logger ^logger)\n{\n\tLoggingSupport::setHandler(logger);\n\tMDynamicAudioNormalizer::setLogFunction(dotNetLoggingHandler);\n}\n\nvoid DynamicAudioNormalizer::DynamicAudioNormalizerNET::getVersionInfo([Out] uint32_t %major, [Out] uint32_t %minor, [Out] uint32_t %patch)\n{\n\tpin_ptr<uint32_t> majorPtr = &major;\n\tpin_ptr<uint32_t> minorPtr = &minor;\n\tpin_ptr<uint32_t> patchPtr = &patch;\n\n\tMDynamicAudioNormalizer::getVersionInfo(*majorPtr, *minorPtr, *patchPtr);\n}\n\nvoid DynamicAudioNormalizer::DynamicAudioNormalizerNET::getBuildInfo([Out] String ^%date, [Out] String ^%time, [Out] String ^%compiler, [Out] String ^%arch, [Out] bool %debug)\n{\n\tconst char *datePtr, *timePtr, *compilerPtr, *archPtr; bool debugRef;\n\tMDynamicAudioNormalizer::getBuildInfo(&datePtr, &timePtr, &compilerPtr, &archPtr, debugRef);\n\n\tdate = gcnew String(datePtr);\n\ttime = gcnew String(timePtr);\n\tcompiler = gcnew String(compilerPtr);\n\tarch = gcnew String(archPtr);\n\tdebug = debugRef;\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Constructor & Destructor\n///////////////////////////////////////////////////////////////////////////////\n\nstatic MDynamicAudioNormalizer *createNewInstance(const uint32_t &channels, const uint32_t &sampleRate, const uint32_t &frameLenMsec, const uint32_t &filterSize, const double &peakValue, const double &maxAmplification, const double &targetRms, const double &compressFactor, const bool &channelsCoupled, const bool &enableDCCorrection, const bool &altBoundaryMode)\n{\n\ttry\n\t{\n\t\treturn new MDynamicAudioNormalizer(channels, sampleRate, frameLenMsec, filterSize, peakValue, maxAmplification, targetRms, compressFactor, channelsCoupled, enableDCCorrection, altBoundaryMode, NULL);\n\t}\n\tcatch(...)\n\t{\n\t\tthrow gcnew DynamicAudioNormalizer::DynamicAudioNormalizerNET_Error(\"Creation of native MDynamicAudioNormalizer instance has failed!\");\n\t}\n}\n\nDynamicAudioNormalizer::DynamicAudioNormalizerNET::DynamicAudioNormalizerNET(const uint32_t channels, const uint32_t sampleRate, const uint32_t frameLenMsec, const uint32_t filterSize, const double peakValue, const double maxAmplification, const double targetRms, const double compressFactor, const bool channelsCoupled, const bool enableDCCorrection, const bool altBoundaryMode)\n:\n\tm_instace(createNewInstance(channels, sampleRate, frameLenMsec, filterSize, peakValue, maxAmplification, targetRms, compressFactor, channelsCoupled, enableDCCorrection, altBoundaryMode))\n{\n\tbool initialized = false;\n\ttry\n\t{\n\t\tinitialized = m_instace->initialize();\n\t}\n\tcatch(...)\n\t{\n\t\tthrow gcnew DynamicAudioNormalizer::DynamicAudioNormalizerNET_Error(\"Initialization of native MDynamicAudioNormalizer instance has failed!\");\n\t}\n\t\n\tif(!initialized)\n\t{\n\t\tthrow gcnew DynamicAudioNormalizer::DynamicAudioNormalizerNET_Error(\"Initialization of native MDynamicAudioNormalizer instance has failed!\");\n\t}\n}\n\nDynamicAudioNormalizer::DynamicAudioNormalizerNET::~DynamicAudioNormalizerNET(void)\n{\n\tthis->!DynamicAudioNormalizerNET();\n\tGC::SuppressFinalize(this);\n}\n\nDynamicAudioNormalizer::DynamicAudioNormalizerNET::!DynamicAudioNormalizerNET(void)\n{\n\ttry\n\t{\n\t\tdelete m_instace;\n\t}\n\tcatch(...)\n\t{\n\t\tthrow gcnew System::Exception(\"Destruction of native MDynamicAudioNormalizer instance has failed!\");\n\t}\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Processing Functions\n///////////////////////////////////////////////////////////////////////////////\n\nint64_t DynamicAudioNormalizer::DynamicAudioNormalizerNET::process(array<double, 2> ^samplesIn, array<double, 2> ^samplesOut, const int64_t inputSize)\n{\n\tTRY_CATCH(process, samplesIn, samplesOut, inputSize);\n}\n\nint64_t DynamicAudioNormalizer::DynamicAudioNormalizerNET::p_process(array<double, 2> ^samplesIn, array<double, 2> ^samplesOut, const int64_t inputSize)\n{\n\tuint32_t channels, sampleRate, frameLen, filterSize;\n\tif (!m_instace->getConfiguration(channels, sampleRate, frameLen, filterSize))\n\t{\n\t\tthrow gcnew DynamicAudioNormalizer::DynamicAudioNormalizerNET_Error(\"Failed to retrieve configuration of native MDynamicAudioNormalizer instance!\");\n\t}\n\n\tPIN_ARRAY_2D(samplesIn, double);\n\tif ((samplesIn_dimOuter != channels) || (samplesIn_dimInner < inputSize))\n\t{\n\t\tthrow gcnew DynamicAudioNormalizer::DynamicAudioNormalizerNET_Error(\"Array dimension mismatch: Array must have dimension CHANNEL_COUNT x INPUT_SIZE!\");\n\t}\n\n\tPIN_ARRAY_2D(samplesOut, double);\n\tif ((samplesOut_dimOuter != channels) || (samplesOut_dimInner < inputSize))\n\t{\n\t\tthrow gcnew DynamicAudioNormalizer::DynamicAudioNormalizerNET_Error(\"Array dimension mismatch: Array must have dimension CHANNEL_COUNT x INPUT_SIZE!\");\n\t}\n\n\tint64_t outputSize = -1;\n\tif (!m_instace->process(samplesIn_ptr, samplesOut_ptr, inputSize, outputSize))\n\t{\n\t\tthrow gcnew DynamicAudioNormalizer::DynamicAudioNormalizerNET_Error(\"Native MDynamicAudioNormalizer instance failed to process samples!\");\n\t}\n\n\treturn outputSize;\n}\n\nint64_t DynamicAudioNormalizer::DynamicAudioNormalizerNET::processInplace(array<double,2> ^samplesInOut, const int64_t inputSize)\n{\n\tTRY_CATCH(processInplace, samplesInOut, inputSize);\n}\n\nint64_t DynamicAudioNormalizer::DynamicAudioNormalizerNET::p_processInplace(array<double,2> ^samplesInOut, const int64_t inputSize)\n{\n\tuint32_t channels, sampleRate, frameLen, filterSize;\n\tif(!m_instace->getConfiguration(channels, sampleRate, frameLen, filterSize))\n\t{\n\t\tthrow gcnew DynamicAudioNormalizer::DynamicAudioNormalizerNET_Error(\"Failed to retrieve configuration of native MDynamicAudioNormalizer instance!\");\n\t}\n\n\tPIN_ARRAY_2D(samplesInOut, double);\n\tif((samplesInOut_dimOuter != channels) || (samplesInOut_dimInner < inputSize))\n\t{\n\t\tthrow gcnew DynamicAudioNormalizer::DynamicAudioNormalizerNET_Error(\"Array dimension mismatch: Array must have dimension CHANNEL_COUNT x INPUT_SIZE!\");\n\t}\n\n\tint64_t outputSize = -1;\n\tif(!m_instace->processInplace(samplesInOut_ptr, inputSize, outputSize))\n\t{\n\t\tthrow gcnew DynamicAudioNormalizer::DynamicAudioNormalizerNET_Error(\"Native MDynamicAudioNormalizer instance failed to process samples in-place!\");\n\t}\n\n\treturn outputSize;\n}\n\nint64_t DynamicAudioNormalizer::DynamicAudioNormalizerNET::flushBuffer(array<double,2> ^samplesInOut)\n{\n\tTRY_CATCH(flushBuffer, samplesInOut);\n}\n\nint64_t DynamicAudioNormalizer::DynamicAudioNormalizerNET::p_flushBuffer(array<double,2> ^samplesOut)\n{\n\tuint32_t channels, sampleRate, frameLen, filterSize;\n\tif(!m_instace->getConfiguration(channels, sampleRate, frameLen, filterSize))\n\t{\n\t\tthrow gcnew DynamicAudioNormalizer::DynamicAudioNormalizerNET_Error(\"Failed to retrieve configuration of native MDynamicAudioNormalizer instance!\");\n\t}\n\n\tPIN_ARRAY_2D(samplesOut, double);\n\tif((samplesOut_dimOuter != channels) || (samplesOut_dimInner < 1))\n\t{\n\t\tthrow gcnew DynamicAudioNormalizer::DynamicAudioNormalizerNET_Error(\"Array dimension mismatch: Array must have dimension CHANNEL_COUNT x INPUT_SIZE!\");\n\t}\n\n\tint64_t outputSize = -1;\n\tif(!m_instace->flushBuffer(samplesOut_ptr, samplesOut_dimInner, outputSize))\n\t{\n\t\tthrow gcnew DynamicAudioNormalizer::DynamicAudioNormalizerNET_Error(\"Native MDynamicAudioNormalizer instance failed to flush the buffer!\");\n\t}\n\n\treturn outputSize;\n}\n\nvoid DynamicAudioNormalizer::DynamicAudioNormalizerNET::reset(void)\n{\n\tTRY_CATCH_NORET(reset);\n}\n\nvoid DynamicAudioNormalizer::DynamicAudioNormalizerNET::p_reset(void)\n{\n\tif(!m_instace->reset())\n\t{\n\t\tthrow gcnew DynamicAudioNormalizer::DynamicAudioNormalizerNET_Error(\"Failed to reset the native MDynamicAudioNormalizer instance!\");\n\t}\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Other Functions\n///////////////////////////////////////////////////////////////////////////////\n\nvoid DynamicAudioNormalizer::DynamicAudioNormalizerNET::getConfiguration([Out] uint32_t %channels, [Out] uint32_t %sampleRate, [Out] uint32_t %frameLen, [Out] uint32_t %filterSize)\n{\n\tTRY_CATCH_NORET(getConfiguration, channels, sampleRate, frameLen, filterSize);\n}\n\nvoid DynamicAudioNormalizer::DynamicAudioNormalizerNET::p_getConfiguration([Out] uint32_t %channels, [Out] uint32_t %sampleRate, [Out] uint32_t %frameLen, [Out] uint32_t %filterSize)\n{\n\tpin_ptr<uint32_t> channelsPtr   = &channels;\n\tpin_ptr<uint32_t> sampleRatePtr = &sampleRate;\n\tpin_ptr<uint32_t> frameLenPtr   = &frameLen;\n\tpin_ptr<uint32_t> filterSizePtr = &filterSize;\n\n\tif(!m_instace->getConfiguration(*channelsPtr, *sampleRatePtr, *frameLenPtr, *filterSizePtr))\n\t{\n\t\tthrow gcnew DynamicAudioNormalizer::DynamicAudioNormalizerNET_Error(\"Failed to get configuration of native MDynamicAudioNormalizer instance!\");\n\t}\n}\n\nint64_t DynamicAudioNormalizer::DynamicAudioNormalizerNET::getInternalDelay(void)\n{\n\tTRY_CATCH(getInternalDelay);\n}\n\nint64_t DynamicAudioNormalizer::DynamicAudioNormalizerNET::p_getInternalDelay(void)\n{\n\tint64_t delayInSamples;\n\n\tif(!m_instace->getInternalDelay(delayInSamples))\n\t{\n\t\tthrow gcnew DynamicAudioNormalizer::DynamicAudioNormalizerNET_Error(\"Failed to get internal delay of MDynamicAudioNormalizer instance!\");\n\t}\n\n\treturn delayInSamples;\n}\n"
  },
  {
    "path": "DynamicAudioNormalizerNET/src/DynamicAudioNormalizerNET.h",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Microsoft.NET Wrapper\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n// http://opensource.org/licenses/MIT\n//////////////////////////////////////////////////////////////////////////////////\n\n#pragma once\n\nusing namespace System;\nusing namespace System::Runtime::InteropServices;\n\n#include <DynamicAudioNormalizer.h>\n\nnamespace DynamicAudioNormalizer\n{\n\tpublic delegate void DynamicAudioNormalizerNET_Logger(int, String^);\n\n\tpublic ref struct DynamicAudioNormalizerNET_Error: public System::Exception\n\t{\n\tpublic:\n\t\tDynamicAudioNormalizerNET_Error(const char* message) : Exception(gcnew String(message)) {}\n\t};\n\n\tpublic ref class DynamicAudioNormalizerNET\n\t{\n\tpublic:\n\t\tDynamicAudioNormalizerNET(const uint32_t channels, const uint32_t sampleRate, const uint32_t frameLenMsec, const uint32_t filterSize, const double peakValue, const double maxAmplification, const double targetRms, const double compressFactor, const bool channelsCoupled, const bool enableDCCorrection, const bool altBoundaryMode);\n\t\t~DynamicAudioNormalizerNET(void);\n\t\t!DynamicAudioNormalizerNET(void);\n\n\t\t//Static\n\t\tstatic void getVersionInfo([Out] uint32_t %major, [Out] uint32_t %minor, [Out] uint32_t %patch);\n\t\tstatic void getBuildInfo([Out] String ^%date, [Out] String ^%time, [Out] String ^%compiler, [Out] String ^%arch, [Out] bool %debug);\n\t\tstatic void setLogger(DynamicAudioNormalizerNET_Logger ^test);\n\n\t\t//Processing\n\t\tint64_t process(array<double, 2> ^samplesIn, array<double, 2> ^samplesOut, const int64_t inputSize);\n\t\tint64_t processInplace(array<double,2> ^samplesInOut, const int64_t inputSize);\n\t\tint64_t flushBuffer(array<double,2> ^samplesInOut);\n\t\tvoid reset(void);\n\t\t\n\t\t//Other\n\t\tvoid getConfiguration([Out] uint32_t %channels, [Out] uint32_t %sampleRate, [Out] uint32_t %frameLen, [Out] uint32_t %filterSize);\n\t\tint64_t getInternalDelay(void);\n\n\tprivate:\n\t\tint64_t p_process(array<double, 2> ^samplesIn, array<double, 2> ^samplesOut, const int64_t inputSize);\n\t\tint64_t p_processInplace(array<double,2> ^samplesInOut, const int64_t inputSize);\n\t\tint64_t p_flushBuffer(array<double,2> ^samplesInOut);\n\t\tvoid p_reset(void);\n\n\t\tvoid p_getConfiguration([Out] uint32_t %channels, [Out] uint32_t %sampleRate, [Out] uint32_t %frameLen, [Out] uint32_t %filterSize);\n\t\tint64_t p_getInternalDelay(void);\n\n\t\tstatic DynamicAudioNormalizerNET_Logger ^m_logger;\n\t\tMDynamicAudioNormalizer *const m_instace;\n\t};\n}\n"
  },
  {
    "path": "DynamicAudioNormalizerNET/src/resource.h",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Microsoft.NET Wrapper\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n// http://opensource.org/licenses/MIT\n//////////////////////////////////////////////////////////////////////////////////\n\n//{{NO_DEPENDENCIES}}\n// Microsoft Visual C++ generated include file.\n// Used by app.rc\n"
  },
  {
    "path": "DynamicAudioNormalizerPAS/DynamicAudioNormalizerPAS.cfg",
    "content": "-$A8\n-$B-\n-$C+\n-$D+\n-$E-\n-$F-\n-$G+\n-$H+\n-$I+\n-$J-\n-$K-\n-$L+\n-$M-\n-$N+\n-$O+\n-$P+\n-$Q-\n-$R-\n-$S-\n-$T-\n-$U-\n-$V+\n-$W-\n-$X+\n-$YD\n-$Z1\n-cc\n-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;\n-H+\n-W+\n-M\n-$M16384,1048576\n-K$00400000\n-LE\"c:\\program files (x86)\\borland\\delphi7\\Projects\\Bpl\"\n-LN\"c:\\program files (x86)\\borland\\delphi7\\Projects\\Bpl\"\n-w-UNSAFE_TYPE\n-w-UNSAFE_CODE\n-w-UNSAFE_CAST\n"
  },
  {
    "path": "DynamicAudioNormalizerPAS/DynamicAudioNormalizerPAS.dof",
    "content": "[FileVersion]\nVersion=7.0\n[Compiler]\nA=8\nB=0\nC=1\nD=1\nE=0\nF=0\nG=1\nH=1\nI=1\nJ=0\nK=0\nL=1\nM=0\nN=1\nO=1\nP=1\nQ=0\nR=0\nS=0\nT=0\nU=0\nV=1\nW=0\nX=1\nY=1\nZ=1\nShowHints=1\nShowWarnings=1\nUnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;\nNamespacePrefix=\nSymbolDeprecated=1\nSymbolLibrary=1\nSymbolPlatform=1\nUnitLibrary=1\nUnitPlatform=1\nUnitDeprecated=1\nHResultCompat=1\nHidingMember=1\nHiddenVirtual=1\nGarbage=1\nBoundsError=1\nZeroNilCompat=1\nStringConstTruncated=1\nForLoopVarVarPar=1\nTypedConstVarPar=1\nAsgToTypedConst=1\nCaseLabelRange=1\nForVariable=1\nConstructingAbstract=1\nComparisonFalse=1\nComparisonTrue=1\nComparingSignedUnsigned=1\nCombiningSignedUnsigned=1\nUnsupportedConstruct=1\nFileOpen=1\nFileOpenUnitSrc=1\nBadGlobalSymbol=1\nDuplicateConstructorDestructor=1\nInvalidDirective=1\nPackageNoLink=1\nPackageThreadVar=1\nImplicitImport=1\nHPPEMITIgnored=1\nNoRetVal=1\nUseBeforeDef=1\nForLoopVarUndef=1\nUnitNameMismatch=1\nNoCFGFileFound=1\nMessageDirective=1\nImplicitVariants=1\nUnicodeToLocale=1\nLocaleToUnicode=1\nImagebaseMultiple=1\nSuspiciousTypecast=1\nPrivatePropAccessor=1\nUnsafeType=0\nUnsafeCode=0\nUnsafeCast=0\n[Linker]\nMapFile=0\nOutputObjs=0\nConsoleApp=0\nDebugInfo=0\nRemoteSymbols=0\nMinStackSize=16384\nMaxStackSize=1048576\nImageBase=4194304\nExeDescription=\n[Directories]\nOutputDir=\nUnitOutputDir=\nPackageDLLOutputDir=\nPackageDCPOutputDir=\nSearchPath=\nPackages=vcl;rtl;vclx;indy;vclie;xmlrtl;inetdbbde;inet;inetdbxpress;dbrtl;soaprtl;dsnap;VclSmp;dbexpress;vcldb;dbxcds;inetdb;bdertl;vcldbx;adortl;teeui;teedb;tee;ibxpress;visualclx;visualdbclx;vclactnband;vclshlctrls;dclOfficeXP\nConditionals=\nDebugSourceDirs=\nUsePackages=0\n[Parameters]\nRunParams=\nHostApplication=\nLauncher=\nUseLauncher=0\nDebugCWD=E:\\DeLpHi\\DynamicNormalizer\\bin\\Win32\\Release_DLL\n[Language]\nActiveLang=\nProjectLang=\nRootDir=\n[Version Info]\nIncludeVerInfo=0\nAutoIncBuild=0\nMajorVer=1\nMinorVer=0\nRelease=0\nBuild=0\nDebug=0\nPreRelease=0\nSpecial=0\nPrivate=0\nDLL=0\nLocale=1031\nCodePage=1252\n[Version Info Keys]\nCompanyName=\nFileDescription=\nFileVersion=1.0.0.0\nInternalName=\nLegalCopyright=\nLegalTrademarks=\nOriginalFilename=\nProductName=\nProductVersion=1.0.0.0\nComments=\n[HistoryLists\\hlUnitAliases]\nCount=1\nItem0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;\n"
  },
  {
    "path": "DynamicAudioNormalizerPAS/DynamicAudioNormalizerPAS.dpr",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Delphi/Pascal Wrapper\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n// http://opensource.org/licenses/MIT\n//////////////////////////////////////////////////////////////////////////////////\n\nprogram DynamicAudioNormalizerPAS;\n\nuses\n  Forms,\n  DynamicAudioNormalizerExample in 'src\\DynamicAudioNormalizerExample.pas' {DynamicAudioNormalizerTestApp},\n  DynamicAudioNormalizer in 'include\\DynamicAudioNormalizer.pas';\n\n{$R *.res}\n\nbegin\n  Application.Initialize;\n  Application.Title := 'Dynamic Audio Normalizer Testbed';\n  Application.CreateForm(TDynamicAudioNormalizerTestApp, DynamicAudioNormalizerTestApp);\n  Application.Run;\nend.\n"
  },
  {
    "path": "DynamicAudioNormalizerPAS/include/DynamicAudioNormalizer.pas",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Delphi/Pascal Wrapper\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n// http://opensource.org/licenses/MIT\n//////////////////////////////////////////////////////////////////////////////////\n\n// *******************************************************************************\n// NOTE: This code was developed and tested with Borland Delphi 7.1 Professional\n// *******************************************************************************\n\nunit DynamicAudioNormalizer;\n\n//=============================================================================\ninterface\n//=============================================================================\n\nuses\n  SysUtils;\n\ntype\n  TDoubleArray = array of Double;\n\ntype\n  TLoggingFunction = procedure(const level: LongInt; const text: PAnsiChar); cdecl;\n  PLoggingFunction = ^TLoggingFunction;\n\ntype\n  TDynamicAudioNormalizer = class(TObject)\n  public\n    //Constructor & Destructor\n    constructor Create(const channels: LongWord; const sampleRate: LongWord; const frameLenMsec: LongWord; const filterSize: LongWord; const peakValue: Double; const maxAmplification: Double; const targetRms: Double; const compressFactor: Double; const channelsCoupled: Boolean; const enableDCCorrection: Boolean; const altBoundaryMode: Boolean);\n    destructor Destroy; override;\n    //Processing Functions\n    function Process(samplesIn: Array of TDoubleArray; samplesOut: Array of TDoubleArray; const sampleCount: Int64): Int64;\n    function ProcessInplace(samplesInOut: Array of TDoubleArray; const sampleCount: Int64): Int64;\n    function FlushBuffer(samplesOut: Array of TDoubleArray): Int64;\n    procedure Reset;\n    //Utility Functions\n    procedure GetConfiguration(var channels: LongWord; var sampleRate: LongWord; var frameLen: LongWord; var filterSize: LongWord);\n    function GetInternalDelay: Int64;\n    //Static Functions\n    class function SetLogFunction(const logFunction: PLoggingFunction): PLoggingFunction;\n    class procedure GetVersionInfo(var major: LongWord; var minor: LongWord; var patch: LongWord);\n    class procedure GetBuildInfo(var date: PAnsiChar; var time: PAnsiChar; var compiler: PAnsiChar; var arch: PAnsiChar; var debug: LongBool);\n  private\n    instance: Pointer;\n  end;\n\n//=============================================================================\nimplementation\n//=============================================================================\n\nconst DynamicAudioNormalizerTag = '_r8';\nconst DynamicAudioNormalizerDLL = 'DynamicAudioNormalizerAPI.dll';\nconst DynamicAudioNormalizerPre = 'MDynamicAudioNormalizer_';\n\n//-----------------------------------------------------------------------------\n// Native Functions\n//-----------------------------------------------------------------------------\n\nfunction  DynAudNorm_CreateInstance(const channels: LongWord; const sampleRate: LongWord; const frameLenMsec: LongWord; const filterSize: LongWord; const peakValue: Double; const maxAmplification: Double; const targetRms: Double; const compressFactor: Double; const channelsCoupled: LongBool; const enableDCCorrection: LongBool; const altBoundaryMode: LongBool; const logFile: Pointer): Pointer; cdecl; external DynamicAudioNormalizerDLL name (DynamicAudioNormalizerPre + 'createInstance' + DynamicAudioNormalizerTag);\nprocedure DynAudNorm_DestroyInstance(var handle: Pointer); cdecl; external DynamicAudioNormalizerDLL name (DynamicAudioNormalizerPre + 'destroyInstance' + DynamicAudioNormalizerTag);\nfunction  DynAudNorm_Process(const handle: Pointer; const samplesIn: Pointer; const samplesOut: Pointer; const inputSize: Int64; var outputSize: Int64): LongBool; cdecl; external DynamicAudioNormalizerDLL name (DynamicAudioNormalizerPre + 'processInplace' + DynamicAudioNormalizerTag);\nfunction  DynAudNorm_ProcessInplace(const handle: Pointer; const samplesInOut: Pointer; const inputSize: Int64; var outputSize: Int64): LongBool; cdecl; external DynamicAudioNormalizerDLL name (DynamicAudioNormalizerPre + 'processInplace' + DynamicAudioNormalizerTag);\nfunction  DynAudNorm_FlushBuffer(const handle: Pointer; const samplesOut: Pointer; const bufferSize: Int64; var outputSize: Int64): LongBool; cdecl; external DynamicAudioNormalizerDLL name (DynamicAudioNormalizerPre + 'flushBuffer' + DynamicAudioNormalizerTag);\nfunction  DynAudNorm_GetConfiguration(const handle: Pointer; var channels: LongWord; var sampleRate: LongWord; var frameLen: LongWord; var filterSize: LongWord): LongBool; cdecl; external DynamicAudioNormalizerDLL name (DynamicAudioNormalizerPre + 'getConfiguration' + DynamicAudioNormalizerTag);\nfunction  DynAudNorm_Reset(const handle: Pointer): LongBool; cdecl; external DynamicAudioNormalizerDLL name (DynamicAudioNormalizerPre + 'reset' + DynamicAudioNormalizerTag);\nfunction  DynAudNorm_GetInternalDelay(const handle: Pointer; var delayInSamples: Int64): LongBool; cdecl; external DynamicAudioNormalizerDLL name (DynamicAudioNormalizerPre + 'getInternalDelay' + DynamicAudioNormalizerTag);\nfunction  DynAudNorm_SetLogFunction(const logFunction: PLoggingFunction): PLoggingFunction; cdecl; external DynamicAudioNormalizerDLL name (DynamicAudioNormalizerPre + 'setLogFunction' + DynamicAudioNormalizerTag);\nfunction  DynAudNorm_GetVersionInfo(var major: LongWord; var minor: LongWord; var patch: LongWord): LongBool; cdecl; external DynamicAudioNormalizerDLL name (DynamicAudioNormalizerPre + 'getVersionInfo' + DynamicAudioNormalizerTag);\nfunction  DynAudNorm_GetBuildInfo(var date: PAnsiChar; var time: PAnsiChar; var compiler: PAnsiChar; var arch: PAnsiChar; var debug: LongBool): LongBool; cdecl; external DynamicAudioNormalizerDLL name (DynamicAudioNormalizerPre + 'getBuildInfo' + DynamicAudioNormalizerTag);\n\n//-----------------------------------------------------------------------------\n// Static Functions\n//-----------------------------------------------------------------------------\n\nclass procedure TDynamicAudioNormalizer.GetVersionInfo(var major: LongWord; var minor: LongWord; var patch: LongWord);\nbegin\n  if not DynAudNorm_GetVersionInfo(major, minor, patch) then\n  begin\n    Raise Exception.Create('Failed to retrieve library version info!');\n  end;\nend;\n\nclass procedure TDynamicAudioNormalizer.GetBuildInfo(var date: PAnsiChar; var time: PAnsiChar; var compiler: PAnsiChar; var arch: PAnsiChar; var debug: LongBool);\nbegin\n  if not DynAudNorm_GetBuildInfo(date, time, compiler, arch, debug) then\n  begin\n    Raise Exception.Create('Failed to retrieve library build configuration!');\n  end;\nend;\n\nclass function TDynamicAudioNormalizer.SetLogFunction(const logFunction: PLoggingFunction): PLoggingFunction;\nbegin\n  Result := DynAudNorm_SetLogFunction(logFunction);\nend;\n\n//-----------------------------------------------------------------------------\n// Constructor & Destructor\n//-----------------------------------------------------------------------------\n\nconstructor TDynamicAudioNormalizer.Create(const channels: LongWord; const sampleRate: LongWord; const frameLenMsec: LongWord; const filterSize: LongWord; const peakValue: Double; const maxAmplification: Double; const targetRms: Double; const compressFactor: Double; const channelsCoupled: Boolean; const enableDCCorrection: Boolean; const altBoundaryMode: Boolean);\nbegin\n  instance := DynAudNorm_CreateInstance(channels, sampleRate, frameLenMsec, filterSize, peakValue, maxAmplification, targetRms, compressFactor, channelsCoupled, enableDCCorrection, altBoundaryMode, nil);\n  if not Assigned(instance) then\n  begin\n    Raise Exception.Create('Failed to create DynamicAudioNormalizer instance!');\n  end;\nend;\n\ndestructor TDynamicAudioNormalizer.Destroy;\nbegin\n  if Assigned(instance) then\n  begin\n    DynAudNorm_DestroyInstance(instance);\n    if Assigned(instance) then\n    begin\n      Raise Exception.Create('Failed to destroy DynamicAudioNormalizer instance!');\n    end;\n  end;\n  inherited; {Parent Destructor}\nend;\n\n//-----------------------------------------------------------------------------\n// Processing Functions\n//-----------------------------------------------------------------------------\n\nfunction TDynamicAudioNormalizer.Process(samplesIn: Array of TDoubleArray; samplesOut: Array of TDoubleArray; const sampleCount: Int64): Int64;\nvar\n  bufferIn, bufferOut: Array of Pointer;\n  i: LongWord;\n  channels, sampleRate, frameLen, filterSize: LongWord;\n  outputSize: Int64;\nbegin\n  if not Assigned(instance) then\n  begin\n    Raise Exception.Create('Native instance not created yet!');\n  end;\n\n  GetConfiguration(channels, sampleRate, frameLen, filterSize);\n  if Length(samplesIn) <> Integer(channels) then\n  begin\n    Raise Exception.Create('Array dimension doesn''t match channel count!');\n  end;\n  if Length(samplesOut) <> Integer(channels) then\n  begin\n    Raise Exception.Create('Array dimension doesn''t match channel count!');\n  end;\n\n  SetLength(bufferIn,  Length(samplesIn));\n  SetLength(bufferOut, Length(samplesOut));\n\n  for i := 0 to Length(samplesIn)-1 do\n  begin\n    if Length(samplesIn[i]) < sampleCount then\n    begin\n      Raise Exception.Create('Array length is smaller than specified sample count!');\n    end;\n    if Length(samplesOut[i]) < sampleCount then\n    begin\n      Raise Exception.Create('Array length is smaller than specified sample count!');\n    end;\n    bufferIn[i]  := @samplesIn [i][0];\n    bufferOut[i] := @samplesOut[i][0];\n  end;\n\n  if not DynAudNorm_Process(instance, @bufferIn[0], @bufferOut[0], sampleCount, outputSize) then\n  begin\n    Raise Exception.Create('Failed to process samples in-place!');\n  end;\n\n  Result := outputSize;\nend;\n\nfunction TDynamicAudioNormalizer.ProcessInplace(samplesInOut: Array of TDoubleArray; const sampleCount: Int64): Int64;\nvar\n  buffer: Array of Pointer;\n  i: LongWord;\n  channels, sampleRate, frameLen, filterSize: LongWord;\n  outputSize: Int64;\nbegin\n  if not Assigned(instance) then\n  begin\n    Raise Exception.Create('Native instance not created yet!');\n  end;\n\n  GetConfiguration(channels, sampleRate, frameLen, filterSize);\n  if Length(samplesInOut) <> Integer(channels) then\n  begin\n    Raise Exception.Create('Array dimension doesn''t match channel count!');\n  end;\n\n  SetLength(buffer, Length(samplesInOut));\n\n  for i := 0 to Length(samplesInOut)-1 do\n  begin\n    if Length(samplesInOut[i]) < sampleCount then\n    begin\n      Raise Exception.Create('Array length is smaller than specified sample count!');\n    end;\n    buffer[i] := @samplesInOut[i][0];\n  end;\n\n  if not DynAudNorm_ProcessInplace(instance, @buffer[0], sampleCount, outputSize) then\n  begin\n    Raise Exception.Create('Failed to process samples in-place!');\n  end;\n\n  Result := outputSize;\nend;\n\nfunction TDynamicAudioNormalizer.FlushBuffer(samplesOut: Array of TDoubleArray): Int64;\nvar\n  buffer: Array of Pointer;\n  i: LongWord;\n  channels, sampleRate, frameLen, filterSize: LongWord;\n  outputSize: Int64;\nbegin\n  if not Assigned(instance) then\n  begin\n    Raise Exception.Create('Native instance not created yet!');\n  end;\n\n  GetConfiguration(channels, sampleRate, frameLen, filterSize);\n  if Length(samplesOut) <> Integer(channels) then\n  begin\n    Raise Exception.Create('Array dimension doesn''t match channel count!');\n  end;\n  \n  SetLength(buffer, Length(samplesOut));\n\n  for i := 0 to Length(samplesOut)-1 do\n  begin\n    if Length(samplesOut[i]) <> Length(samplesOut[0]) then\n    begin\n      Raise Exception.Create('Lengths of \"inner\" array''s are *not* inconsistent!');\n    end;\n    buffer[i] := @samplesOut[i][0];\n  end;\n\n  if not DynAudNorm_FlushBuffer(instance, @buffer[0], Length(samplesOut[0]), outputSize) then\n  begin\n    Raise Exception.Create('Failed to flush samples from buffer!');\n  end;\n\n  Result := outputSize;\nend;\n\nprocedure  TDynamicAudioNormalizer.Reset;\nbegin\n  if not Assigned(instance) then\n  begin\n    Raise Exception.Create('Native instance not created yet!');\n  end;\n\n  if not DynAudNorm_Reset(instance) then\n  begin\n    Raise Exception.Create('Failed to reset DynamicAudioNormalizer instance!');\n  end;\nend;\n\n//-----------------------------------------------------------------------------\n// Utility Functions\n//-----------------------------------------------------------------------------\n\nprocedure TDynamicAudioNormalizer.GetConfiguration(var channels: LongWord; var sampleRate: LongWord; var frameLen: LongWord; var filterSize: LongWord);\nbegin\n  if not Assigned(instance) then\n  begin\n    Raise Exception.Create('Native instance not created yet!');\n  end;\n\n  if not DynAudNorm_GetConfiguration(instance, channels, sampleRate, frameLen, filterSize) then\n  begin\n    Raise Exception.Create('Failed to get current configuration!');\n  end;\nend;\n\nfunction TDynamicAudioNormalizer.GetInternalDelay: Int64;\nbegin\n  if not Assigned(instance) then\n  begin\n    Raise Exception.Create('Native instance not created yet!');\n  end;\n\n  if not DynAudNorm_GetInternalDelay(instance, Result) then\n  begin\n    Raise Exception.Create('Failed to get current configuration!');\n  end;\nend;\n\nend.\n"
  },
  {
    "path": "DynamicAudioNormalizerPAS/src/DynamicAudioNormalizerExample.dfm",
    "content": "object DynamicAudioNormalizerTestApp: TDynamicAudioNormalizerTestApp\n  Left = 618\n  Top = 301\n  BorderIcons = [biSystemMenu, biMinimize]\n  BorderStyle = bsSingle\n  Caption = 'DynAudNorm Testbed'\n  ClientHeight = 145\n  ClientWidth = 267\n  Color = clBtnFace\n  Font.Charset = DEFAULT_CHARSET\n  Font.Color = clWindowText\n  Font.Height = -11\n  Font.Name = 'MS Sans Serif'\n  Font.Style = []\n  OldCreateOrder = False\n  Position = poScreenCenter\n  OnCreate = FormCreate\n  PixelsPerInch = 96\n  TextHeight = 13\n  object ButtonTest1: TButton\n    Left = 8\n    Top = 8\n    Width = 249\n    Height = 25\n    Caption = 'Create and Destory many instances'\n    TabOrder = 0\n    OnClick = ButtonTest1Click\n  end\n  object ButtonExit: TButton\n    Left = 8\n    Top = 112\n    Width = 249\n    Height = 25\n    Caption = 'Exit'\n    TabOrder = 1\n    OnClick = ButtonExitClick\n  end\n  object ButtonTest2: TButton\n    Left = 8\n    Top = 40\n    Width = 249\n    Height = 25\n    Caption = 'Process complete Audio File'\n    TabOrder = 2\n    OnClick = ButtonTest2Click\n  end\n  object ProgressBar1: TProgressBar\n    Left = 8\n    Top = 80\n    Width = 249\n    Height = 17\n    Smooth = True\n    TabOrder = 3\n  end\n  object ApplicationEvents1: TApplicationEvents\n    OnException = ApplicationEvents1Exception\n    Left = 8\n    Top = 72\n  end\n  object XPManifest1: TXPManifest\n    Left = 40\n    Top = 72\n  end\n  object OpenDialog: TOpenDialog\n    DefaultExt = 'pcm'\n    Filter = 'Raw PCM data (*.pcm)|*.pcm'\n    Options = [ofHideReadOnly, ofNoChangeDir, ofPathMustExist, ofFileMustExist, ofEnableSizing]\n    Title = 'Select Source File'\n    Left = 72\n    Top = 72\n  end\n  object SaveDialog: TSaveDialog\n    DefaultExt = 'pcm'\n    Filter = 'Raw PCM data (*.pcm)|*.pcm'\n    Options = [ofOverwritePrompt, ofHideReadOnly, ofNoChangeDir, ofPathMustExist, ofEnableSizing]\n    Title = 'Select Output File'\n    Left = 104\n    Top = 72\n  end\nend\n"
  },
  {
    "path": "DynamicAudioNormalizerPAS/src/DynamicAudioNormalizerExample.pas",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Delphi/Pascal Wrapper\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n// http://opensource.org/licenses/MIT\n//////////////////////////////////////////////////////////////////////////////////\n\nunit DynamicAudioNormalizerExample;\n\ninterface\n\nuses\n  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,\n  Dialogs, StdCtrls, AppEvnts, Math, DateUtils, ComCtrls, XPMan;\n\ntype\n  TDynamicAudioNormalizerTestApp = class(TForm)\n    ButtonTest1: TButton;\n    ButtonExit: TButton;\n    ButtonTest2: TButton;\n    ApplicationEvents1: TApplicationEvents;\n    ProgressBar1: TProgressBar;\n    XPManifest1: TXPManifest;\n    OpenDialog: TOpenDialog;\n    SaveDialog: TSaveDialog;\n    procedure ButtonTest1Click(Sender: TObject);\n    procedure ButtonExitClick(Sender: TObject);\n    procedure ButtonTest2Click(Sender: TObject);\n    procedure ApplicationEvents1Exception(Sender: TObject; E: Exception);\n    procedure FormCreate(Sender: TObject);\n  private\n    LastUpdate: TDateTime;\n    procedure StartStopTest(const start: boolean);\n    procedure UpdateProgress;\n  public\n    { Public-Deklarationen }\n  end;\n\nvar\n  DynamicAudioNormalizerTestApp: TDynamicAudioNormalizerTestApp;\n\nimplementation\n\nuses\n  DynamicAudioNormalizer;\n\n{$R *.dfm}\n\n//-----------------------------------------------------------------------------\n// Log Callback\n//-----------------------------------------------------------------------------\n\n{WARNING: This function must use 'cdecl' calling convention!}\n\nprocedure loggingHandler(const level: LongInt; const text: PAnsiChar); cdecl;\nvar\n  tag: String;\nbegin\n  case level of\n    0: tag := 'DBG';\n    1: tag := 'WRN';\n    2: tag := 'ERR';\n  else\n    tag := '???';\n  end;\n\n  WriteLn(Format('[DynAudNorm][%s] %s', [tag, text]));\nend;\n\n//-----------------------------------------------------------------------------\n// Helper Functions\n//-----------------------------------------------------------------------------\n\nprocedure TDynamicAudioNormalizerTestApp.UpdateProgress;\nbegin\n  if ProgressBar1.Position < ProgressBar1.Max then\n  begin\n    ProgressBar1.StepBy(1);\n    LastUpdate := Now;\n  end else\n  begin\n    if MilliSecondsBetween(Now, LastUpdate) >= 997 then\n    begin\n      ProgressBar1.Position := 0;\n      LastUpdate := Now;\n    end\n  end;\n  Application.ProcessMessages;\nend;\n\nprocedure TDynamicAudioNormalizerTestApp.StartStopTest(const start: boolean);\nvar\n  i: Integer;\nbegin\n  if start then\n  begin\n    for i := 0 to Self.ControlCount-1 do\n    begin\n      Self.Controls[i].Enabled := False;\n    end;\n    ProgressBar1.Position := 0;\n  end else\n  begin\n    MessageBeep(1000);\n    for i := 0 to Self.ControlCount-1 do\n    begin\n      Self.Controls[i].Enabled := True;\n    end;\n    ProgressBar1.Position := ProgressBar1.Max;\n  end;\nend;\n\n//-----------------------------------------------------------------------------\n// Misc Functions\n//-----------------------------------------------------------------------------\n\nprocedure TDynamicAudioNormalizerTestApp.FormCreate(Sender: TObject);\nvar\n  major, minor, patch: LongWord;\n  date, time, compiler, arch: PAnsiChar;\n  debug: LongBool;\nbegin\n  LastUpdate := Now;\n\n  TDynamicAudioNormalizer.GetVersionInfo(major, minor, patch);\n  WriteLn(Format('Library Version: %s', [StringReplace(Format('%u.%02u-%u', [major, minor, patch]), ' ', '0', [rfReplaceAll])]));\n\n  TDynamicAudioNormalizer.GetBuildInfo(date, time, compiler, arch, debug);\n  WriteLn(Format('Build: Date=%s; Time=%s; Compiler=%s; Arch=%s; Debug=%s'#10, [date, time, compiler, arch, BoolToStr(debug)]));\n\n  TDynamicAudioNormalizer.SetLogFunction(@loggingHandler);\nend;\n\nprocedure TDynamicAudioNormalizerTestApp.ButtonExitClick(Sender: TObject);\nbegin\n  Application.Terminate;\nend;\n\nprocedure TDynamicAudioNormalizerTestApp.ApplicationEvents1Exception(Sender: TObject; E: Exception);\nbegin\n  MessageBox(self.Handle, @E.Message[1], 'ERROR', MB_ICONERROR or MB_TOPMOST);\n  ExitProcess(DWORD(-1));\nend;\n\n//-----------------------------------------------------------------------------\n// TEST #1\n//-----------------------------------------------------------------------------\n\nprocedure TDynamicAudioNormalizerTestApp.ButtonTest1Click(Sender: TObject);\nconst\n  rounds = 97;\n  instances = 16;\nvar\n  normalizer: Array [1..instances] of TDynamicAudioNormalizer;\n  i,k: Cardinal;\nbegin\n  StartStopTest(True);\n\n  for k := 1 to rounds do\n  begin\n    WriteLn('Round ' + IntToStr(k) + ' of ' + IntToStr(rounds) + '.');\n    for i := 1 to instances do\n    begin\n      normalizer[i] := TDynamicAudioNormalizer.Create(2, 44100, 500, 31, 0.95, 10.0, 0.0, 0.0, True, False, False);\n      if i mod 4 = 0 then UpdateProgress;\n    end;\n    for i := 1 to instances do\n    begin\n      FreeAndNil(normalizer[i]);\n      if i mod 4 = 0 then UpdateProgress;\n    end;\n  end;\n  \n  WriteLn('Done.'#10);\n  StartStopTest(False);\n  \n  MessageBox(self.WindowHandle, 'Test completed successfully.', PAnsiChar(self.Caption), MB_ICONINFORMATION);\nend;\n\n//-----------------------------------------------------------------------------\n// TEST #2\n//-----------------------------------------------------------------------------\n\nprocedure TDynamicAudioNormalizerTestApp.ButtonTest2Click(Sender: TObject);\nconst\n  frameSize = 4096;\n  channelCount = 2;\n  MAX_SHORT: Double = 32767.0;\nvar\n  samples: Array of TDoubleArray;\n  buffer: array[0..((channelCount*frameSize)-1)] of SmallInt;\n  inputFile, outputFile: THandle;\n  normalizer: TDynamicAudioNormalizer;\n  i, j, k, q: Cardinal;\n  readSize, writeSize, bytesWritten: Cardinal;\nbegin\n  {========================= SELECT FILES ========================}\n\n  if not OpenDialog.Execute then\n  begin\n    Exit;\n  end;\n\n  if not SaveDialog.Execute then\n  begin\n    Exit;\n  end;\n\n  {============================ SETUP ============================}\n\n  StartStopTest(True);\n  \n  SetLength(samples, channelCount, frameSize);\n\n  WriteLn('Open I/O files...');\n  inputFile  := CreateFile(PAnsiChar(OpenDialog.Files[0]),  GENERIC_READ, FILE_SHARE_READ, nil, OPEN_EXISTING, 0, 0);\n  outputFile := CreateFile(PAnsiChar(SaveDialog.Files[0]), GENERIC_WRITE, 0, nil, CREATE_ALWAYS, 0, 0);\n\n  if (inputFile = INVALID_HANDLE_VALUE) or (outputFile = INVALID_HANDLE_VALUE) then\n  begin\n    Raise Exception.Create('Failed to open input/output files!');\n  end;\n\n  WriteLn('Creating normalizer instance...');\n  normalizer := TDynamicAudioNormalizer.Create(channelCount, 44100, 500, 31, 0.95, 10.0, 0.0, 0.0, True, False, False);\n  WriteLn('Internal delay: ' + IntToStr(normalizer.GetInternalDelay));\n\n  {=========================== PROCESS ===========================}\n\n  WriteLn('Processing, please wait...');\n  for q := 0 to 2147483647 do\n  begin\n    if not ReadFile(inputFile, buffer, frameSize * channelCount * SizeOf(SmallInt), readSize, nil) then\n    begin\n      Raise Exception.Create('Read operation has failed!');\n    end;\n\n    readSize := readSize div (channelCount * SizeOf(SmallInt));\n\n    if readSize > 0 then\n    begin\n      k := 0;\n      for i := 0 to (readSize-1) do\n      begin\n        for j := 0 to (channelCount-1) do\n        begin\n          samples[j][i] := buffer[k] / MAX_SHORT;\n          k := k + 1;\n        end;\n      end;\n    end;\n\n    writeSize := normalizer.ProcessInplace(samples, readSize);\n    //WriteLn('Result: readSize=' + IntToStr(readSize) + '; writeSize=' +  IntToStr(writeSize));\n\n    if writeSize > 0 then\n    begin\n      k := 0;\n      for i := 0 to (writeSize-1) do\n      begin\n        for j := 0 to (channelCount-1) do\n        begin\n          buffer[k] := SmallInt(Round(Max(-1.0,Min(1.0,samples[j][i])) * MAX_SHORT));\n          k := k + 1;\n        end;\n      end;\n      if not WriteFile(outputFile, buffer, writeSize * channelCount * SizeOf(SmallInt), bytesWritten, nil) then\n      begin\n        Raise Exception.Create('Write operation has failed!');\n      end;\n    end;\n\n    if readSize < frameSize then\n    begin\n      Break; {End of File}\n    end;\n\n    if q mod 32 = 0 then\n    begin\n      UpdateProgress;\n    end;\n  end;\n\n  {============================ FLUSH ============================}\n\n  WriteLn('Flushing buffer, please wait...');\n  for q := 0 to 2147483647 do\n  begin\n    writeSize := normalizer.FlushBuffer(samples);\n\n    if writeSize > 0 then\n    begin\n      k := 0;\n      for i := 0 to (writeSize-1) do\n      begin\n        for j := 0 to (channelCount-1) do\n        begin\n          buffer[k] := SmallInt(Round(Max(-1.0,Min(1.0,samples[j][i])) * MAX_SHORT));\n          k := k + 1;\n        end;\n      end;\n      if not WriteFile(outputFile, buffer, writeSize * channelCount * SizeOf(SmallInt), bytesWritten, nil) then\n      begin\n        Raise Exception.Create('Write operation has failed!');\n      end;\n    end;\n\n    if writeSize < 1 then\n    begin\n      Break; {No more samples left}\n    end;\n\n    if q mod 32 = 0 then\n    begin\n      UpdateProgress;\n    end;\n  end;\n\n  {============================ CLOSE ============================}\n\n  WriteLn('Shutting down...');\n  normalizer.Reset(); {Just to make sure that the Reset() function works}\n\n  {============================ RESET ============================}\n\n  FreeAndNil(normalizer);\n  FlushFileBuffers(outputFile);\n\n  CloseHandle(inputFile);\n  CloseHandle(outputFile);\n\n  WriteLn('Done.'#10);\n  StartStopTest(False);\n\n  MessageBox(self.WindowHandle, 'Test completed successfully.', PAnsiChar(self.Caption), MB_ICONINFORMATION);\nend;\n\nend.\n"
  },
  {
    "path": "DynamicAudioNormalizerPYD/DynamicAudioNormalizerPYD_VS2013.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"14.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"Debug|Win32\">\n      <Configuration>Debug</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|Win32\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Debug|x64\">\n      <Configuration>Debug</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|x64\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|Win32\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|x64\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\DynamicAudioNormalizerPYD.cpp\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\DynamicAudioNormalizerAPI\\DynamicAudioNormalizerAPI_VS2013.vcxproj\">\n      <Project>{376386ee-8268-47e3-a335-7663716e4c60}</Project>\n    </ProjectReference>\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <ProjectGuid>{5ACB9827-9D3A-4C59-A948-8505D1544A8E}</ProjectGuid>\n    <Keyword>Win32Proj</Keyword>\n    <RootNamespace>DynamicAudioNormalizerPYD</RootNamespace>\n    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>\n    <ProjectName>DynamicAudioNormalizerPYD</ProjectName>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"Shared\">\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <LinkIncremental>true</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <TargetExt>.pyd</TargetExt>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <LinkIncremental>true</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <TargetExt>.pyd</TargetExt>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <TargetExt>.pyd</TargetExt>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <TargetExt>.pyd</TargetExt>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <TargetExt>.pyd</TargetExt>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <TargetExt>.pyd</TargetExt>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <ClCompile>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERPYD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\..\\Prerequisites\\Python3\\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n      <EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\Python3\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <ClCompile>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERPYD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\..\\Prerequisites\\Python3\\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\Python3\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERPYD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\..\\Prerequisites\\Python3\\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\Python3\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_STATIC;DYNAMICAUDIONORMALIZERPYD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\..\\Prerequisites\\Python3\\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\Python3\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERPYD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\..\\Prerequisites\\Python3\\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\Python3\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_STATIC;DYNAMICAUDIONORMALIZERPYD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\..\\Prerequisites\\Python3\\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\Python3\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerPYD/DynamicAudioNormalizerPYD_VS2013.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\DynamicAudioNormalizerPYD.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerPYD/DynamicAudioNormalizerPYD_VS2015.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"14.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"Debug|Win32\">\n      <Configuration>Debug</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|Win32\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Debug|x64\">\n      <Configuration>Debug</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|x64\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|Win32\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|x64\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\DynamicAudioNormalizerPYD.cpp\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\DynamicAudioNormalizerAPI\\DynamicAudioNormalizerAPI_VS2015.vcxproj\">\n      <Project>{376386ee-8268-47e3-a335-7663716e4c60}</Project>\n    </ProjectReference>\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <ProjectGuid>{5ACB9827-9D3A-4C59-A948-8505D1544A8E}</ProjectGuid>\n    <Keyword>Win32Proj</Keyword>\n    <RootNamespace>DynamicAudioNormalizerPYD</RootNamespace>\n    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>\n    <ProjectName>DynamicAudioNormalizerPYD</ProjectName>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"Shared\">\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <LinkIncremental>true</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <TargetExt>.pyd</TargetExt>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <LinkIncremental>true</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <TargetExt>.pyd</TargetExt>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <TargetExt>.pyd</TargetExt>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <TargetExt>.pyd</TargetExt>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <TargetExt>.pyd</TargetExt>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <TargetExt>.pyd</TargetExt>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <ClCompile>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERPYD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\..\\Prerequisites\\Python3\\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n      <EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\Python3\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <ClCompile>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERPYD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\..\\Prerequisites\\Python3\\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\Python3\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERPYD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\..\\Prerequisites\\Python3\\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\Python3\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_STATIC;DYNAMICAUDIONORMALIZERPYD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\..\\Prerequisites\\Python3\\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\Python3\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERPYD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\..\\Prerequisites\\Python3\\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\Python3\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_STATIC;DYNAMICAUDIONORMALIZERPYD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\..\\Prerequisites\\Python3\\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\Python3\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerPYD/DynamicAudioNormalizerPYD_VS2015.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\DynamicAudioNormalizerPYD.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerPYD/DynamicAudioNormalizerPYD_VS2017.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"14.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"Debug|Win32\">\n      <Configuration>Debug</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|Win32\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Debug|x64\">\n      <Configuration>Debug</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|x64\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|Win32\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|x64\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\DynamicAudioNormalizerPYD.cpp\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\DynamicAudioNormalizerAPI\\DynamicAudioNormalizerAPI_VS2017.vcxproj\">\n      <Project>{376386ee-8268-47e3-a335-7663716e4c60}</Project>\n    </ProjectReference>\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"res\\DynamicAudioNormalizerPYD.rc\" />\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <ProjectGuid>{5ACB9827-9D3A-4C59-A948-8505D1544A8E}</ProjectGuid>\n    <Keyword>Win32Proj</Keyword>\n    <RootNamespace>DynamicAudioNormalizerPYD</RootNamespace>\n    <WindowsTargetPlatformVersion>7.0</WindowsTargetPlatformVersion>\n    <ProjectName>DynamicAudioNormalizerPYD</ProjectName>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"Shared\">\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <LinkIncremental>true</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <TargetExt>.pyd</TargetExt>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <LinkIncremental>true</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <TargetExt>.pyd</TargetExt>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <TargetExt>.pyd</TargetExt>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <TargetExt>.pyd</TargetExt>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <TargetExt>.pyd</TargetExt>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n    <TargetExt>.pyd</TargetExt>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <ClCompile>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERPYD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\..\\Prerequisites\\Python3\\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n      <EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\Python3\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <ClCompile>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERPYD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\..\\Prerequisites\\Python3\\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\Python3\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERPYD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\..\\Prerequisites\\Python3\\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\Python3\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n    <Manifest>\n      <AdditionalManifestFiles>$(SolutionDir)DynamicAudioNormalizerShared\\res\\compat.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>\n    </Manifest>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_STATIC;DYNAMICAUDIONORMALIZERPYD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\..\\Prerequisites\\Python3\\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\Python3\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n    <Manifest>\n      <AdditionalManifestFiles>$(SolutionDir)DynamicAudioNormalizerShared\\res\\compat.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>\n    </Manifest>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERPYD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\..\\Prerequisites\\Python3\\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\Python3\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n    <Manifest>\n      <AdditionalManifestFiles>$(SolutionDir)DynamicAudioNormalizerShared\\res\\compat.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>\n    </Manifest>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>\n      </PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_STATIC;DYNAMICAUDIONORMALIZERPYD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\..\\Prerequisites\\Python3\\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\Python3\\lib\\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n    <Manifest>\n      <AdditionalManifestFiles>$(SolutionDir)DynamicAudioNormalizerShared\\res\\compat.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>\n    </Manifest>\n  </ItemDefinitionGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerPYD/DynamicAudioNormalizerPYD_VS2017.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\DynamicAudioNormalizerPYD.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"res\\DynamicAudioNormalizerPYD.rc\">\n      <Filter>Resource Files</Filter>\n    </ResourceCompile>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerPYD/include/DynamicAudioNormalizer.py",
    "content": "##################################################################################\n# Dynamic Audio Normalizer - Python Wrapper\n# Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n# THE SOFTWARE.\n#\n# http://opensource.org/licenses/MIT\n##################################################################################\n\n#import stdlib modules\nimport sys\n\n#define API version\nDYNAMIC_AUDIONORMALIZER_API = 8\n\n#import the native \"C\" module\ntry:\n\timport DynamicAudioNormalizerPYD\nexcept:\n\tpass\n\n#error checking\nif (not 'DynamicAudioNormalizerPYD' in locals()) or (not hasattr(DynamicAudioNormalizerPYD, 'getCoreVersion')):\n\traise SystemError(\"The native DynamicAudioNormalizerPYD module is *not* available. Please make sure that 'DynamicAudioNormalizerPYD.pyd' has been installed correctly!\")\n\n#version checking\nif DynamicAudioNormalizerPYD.getCoreVersion() != DYNAMIC_AUDIONORMALIZER_API:\n\traise SystemError(\"The native DynamicAudioNormalizerPYD module uses an *unsupported* API version. Please install the matching 'DynamicAudioNormalizerPYD.pyd' library!\")\n\n\n#----------------------------------------------------------------------\n# DynamicAudioNormalizer\n#----------------------------------------------------------------------\n\nclass PyDynamicAudioNormalizer:\n\t\"\"\"Wrapper class around the DynamicAudioNormalizerPYD library\"\"\"\n\t\n\tdef __str__(self):\n\t\tversionInfo = self.getVersion()\n\t\tbuildStr = \"built: {} {}, compiler: {}, arch: {}, {}\".format(*versionInfo[1])\n\t\tconfigStr = \"channels={}, samplingRate={}, frameLen={}, filterSize={}\".format(*self.getConfig())\n\t\treturn \"DynamicAudioNormalizer v{}.{}-{} [{}][{}]]\".format(*versionInfo[0], buildStr, configStr)\n\t\n\tdef __init__(self, channels, samplerate, filterSize=31, frameLen=500, peakValue=0.95, maxAmplification=10.0, targetRms=0.0, compressFactor=0.0, channelsCoupled=True, enableDCCorrection=False, altBoundaryMode=False):\n\t\tself._channels = int(channels)\n\t\tself._samplerate = int(samplerate)\n\t\tself._frameLen = int(frameLen)\n\t\tself._filterSize = int(filterSize)\n\t\tself._peakValue = float(peakValue)\n\t\tself._maxAmplification = float(maxAmplification)\n\t\tself._targetRms = float(targetRms)\n\t\tself._compressFactor = float(compressFactor)\n\t\tself._channelsCoupled = not (not channelsCoupled)\n\t\tself._enableDCCorrection = not (not enableDCCorrection)\n\t\tself._altBoundaryMode = not (not altBoundaryMode)\n\t\tself._instance = None\n\t\n\tdef __enter__(self):\n\t\toptions = (self._peakValue, self._maxAmplification, self._targetRms, self._compressFactor, self._channelsCoupled, self._enableDCCorrection, self._altBoundaryMode)\n\t\tself._instance = DynamicAudioNormalizerPYD.createInstance(self._channels, self._samplerate, self._frameLen, self._filterSize, *options)\n\t\treturn self\n\t\n\tdef __exit__(self, type, value, traceback):\n\t\tif not self._instance:\n\t\t\traise RuntimeError(\"Instance not initialized!\")\n\t\tDynamicAudioNormalizerPYD.destroyInstance(self._instance)\n\t\tself._instance = None\n\t\n\tdef __del__(self):\n\t\tif self._instance:\n\t\t\tprint(\"RESOURCE LEAK: DynamicAudioNormalizer object was not de-initialized properly!\", file=sys.stderr)\n\t\n\tdef getConfiguration(self):\n\t\tif not self._instance:\n\t\t\traise RuntimeError(\"Instance not initialized!\")\n\t\treturn DynamicAudioNormalizerPYD.getConfiguration(self._instance)\n\t\n\tdef getInternalDelay(self):\n\t\tif not self._instance:\n\t\t\traise RuntimeError(\"Instance not initialized!\")\n\t\treturn DynamicAudioNormalizerPYD.getInternalDelay(self._instance)\n\t\n\tdef process(self, samplesIn, samplesOut, count):\n\t\tif not self._instance:\n\t\t\traise RuntimeError(\"Instance not initialized!\")\n\t\treturn DynamicAudioNormalizerPYD.process(self._instance, samplesIn, samplesOut, count)\n\t\n\tdef processInplace(self, samplesInOut, count):\n\t\tif not self._instance:\n\t\t\traise RuntimeError(\"Instance not initialized!\")\n\t\treturn DynamicAudioNormalizerPYD.processInplace(self._instance, samplesInOut, count)\n\t\n\tdef flushBuffer(self, samplesOut):\n\t\tif not self._instance:\n\t\t\traise RuntimeError(\"Instance not initialized!\")\n\t\treturn DynamicAudioNormalizerPYD.flushBuffer(self._instance, samplesOut)\n\t\n\t@staticmethod\n\tdef setLogFunction(callback):\n\t\treturn DynamicAudioNormalizerPYD.setLogFunction(callback)\n\t\n\t@staticmethod\n\tdef getVersion():\n\t\treturn DynamicAudioNormalizerPYD.getVersionInfo()\n"
  },
  {
    "path": "DynamicAudioNormalizerPYD/makefile",
    "content": "##############################################################################\n# Dynamic Audio Normalizer - Audio Processing Library\n# Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n#\n# This library is free software; you can redistribute it and/or\n# modify it under the terms of the GNU Lesser General Public\n# License as published by the Free Software Foundation; either\n# version 2.1 of the License, or (at your option) any later version.\n#\n# This library is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n# Lesser General Public License for more details.\n#\n# You should have received a copy of the GNU Lesser General Public\n# License along with this library; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n#\n# http://www.gnu.org/licenses/lgpl-2.1.txt\n##############################################################################\n\nECHO=echo -e\nSHELL=/bin/bash\n\nPYTHON_INC ?= $(shell python3 -c \"from distutils import sysconfig; print(sysconfig.get_python_inc())\" || echo \"/usr/include/python3.5\")\n\n##############################################################################\n# Constants\n##############################################################################\n\nLIBRARY_NAME := DynamicAudioNormalizerPYD\n\nifndef API_VERSION\n   $(error API_VERSION variable is not set!)\nendif\n\n##############################################################################\n# Python Checks\n##############################################################################\n\nifneq ($(MAKECMDGOALS),clean)\n   PY_CHECK := $(shell [ -f $(PYTHON_INC)/Python.h ] && echo true || echo false)\n   ifneq ($(PY_CHECK),true)\n      $(error File \"Python.h\" not found in PYTHON_INC path!)\n   endif\nendif\n\n##############################################################################\n# Flags\n##############################################################################\n\nDEBUG_BUILD ?= 0\nMARCH ?= native\n\nifeq ($(DEBUG_BUILD), 1)\n   CONFIG_NAME = Debug\n   CXXFLAGS = -g -O0 -D_DEBUG\nelse\n   CONFIG_NAME = Release\n   CXXFLAGS = -O3 -Wall -ffast-math -mfpmath=sse -msse -fomit-frame-pointer -fno-tree-vectorize -DNDEBUG -march=$(MARCH)\nendif\n\nifneq ($(findstring MINGW,$(shell uname -s)),MINGW)\n   CXXFLAGS += -fPIC\nendif\n\nCXXFLAGS += -std=gnu++11\nCXXFLAGS += -fvisibility=hidden\n\nCXXFLAGS += -I./src\nCXXFLAGS += -I../DynamicAudioNormalizerAPI/include\nCXXFLAGS += -I../DynamicAudioNormalizerShared/include\nCXXFLAGS += -I$(PYTHON_INC)\n\nifneq ($(findstring MINGW,$(shell uname -s)),MINGW)\n   LDXFLAGS += -Wl,-rpath,'$$ORIGIN'\nendif\n\nLDXFLAGS += -L../DynamicAudioNormalizerAPI/lib\nLDXFLAGS += -lDynamicAudioNormalizerAPI-$(API_VERSION)\nifeq ($(shell uname), Darwin)\n\tPYTHON_LIB := $(shell python3 -c \"from distutils import sysconfig; print(sysconfig.get_config_var('LIBDIR'))\")\n\tPYTHON_VERSION := $(shell python3 -c \"from distutils import sysconfig; print(sysconfig.get_config_var('VERSION'))\")\n\tLDXFLAGS += -lpython$(PYTHON_VERSION) -L$(PYTHON_LIB)\nendif\n\n##############################################################################\n# File Names\n##############################################################################\n\nifeq ($(findstring MINGW,$(shell uname -s)),MINGW)\n   SO_EXT = pyd\n   LDXFLAGS += -Wl,--out-implib,$@.a\n   SHAREDFLAG = -shared\nelse ifeq ($(shell uname), Darwin)\n   SO_EXT = so\n#   SHAREDFLAG = -dynamiclib\n   SHAREDFLAG = -shared\nelse\n   SO_EXT = so\n   SHAREDFLAG = -shared\nendif\n\nSOURCES_CPP = $(wildcard src/*.cpp)\nSOURCES_OBJ = $(patsubst %.cpp,%.o,$(SOURCES_CPP))\n\nLIBRARY_OUT = lib/$(LIBRARY_NAME)\nLIBRARY_BIN = $(LIBRARY_OUT).$(SO_EXT)\nLIBRARY_DBG = $(LIBRARY_OUT)-DBG.$(SO_EXT)\n\n##############################################################################\n# Rules\n##############################################################################\n\n.PHONY: all clean\n\nall: $(LIBRARY_DBG) $(LIBRARY_BIN)\n\n#-------------------------------------------------------------\n# Link & Strip\n#-------------------------------------------------------------\n\n$(LIBRARY_BIN): $(SOURCES_OBJ)\n\t@$(ECHO) \"\\e[1;36m[STR] $@\\e[0m\"\n\t@mkdir -p $(dir $@)\n\tg++ $(SHAREDFLAG) -g0 -o $@ $+ $(LDXFLAGS)\nifeq ($(shell uname), Darwin)\n\tinstall_name_tool -id \"@rpath/$(notdir $@)\" $@\n\tstrip -u -r -x $@\nelse\n\tstrip --strip-unneeded $@\nendif\n\n$(LIBRARY_DBG): $(SOURCES_OBJ)\n\t@$(ECHO) \"\\e[1;36m[LNK] $@\\e[0m\"\n\t@mkdir -p $(dir $@)\n\tg++ $(SHAREDFLAG) -o $@ $+ $(LDXFLAGS)\nifeq ($(shell uname), Darwin)\n\tinstall_name_tool -id \"@rpath/$(notdir $@)\" $@\nendif\n\n#-------------------------------------------------------------\n# Compile\n#-------------------------------------------------------------\n\n%.o: %.cpp\n\t@$(ECHO) \"\\e[1;36m[CXX] $<\\e[0m\"\n\t@mkdir -p $(dir $@)\n\tg++ $(CXXFLAGS) -c $< -o $@\n\n#-------------------------------------------------------------\n# Clean\n#-------------------------------------------------------------\n\nclean:\n\trm -fv $(SOURCES_OBJ)\n\trm -rfv ./lib\n\n"
  },
  {
    "path": "DynamicAudioNormalizerPYD/res/DynamicAudioNormalizerPYD.rc",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Library\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This library is free software; you can redistribute it and/or\n// modify it under the terms of the GNU Lesser General Public\n// License as published by the Free Software Foundation; either\n// version 2.1 of the License, or (at your option) any later version.\n//\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public\n// License along with this library; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n//\n// http://www.gnu.org/licenses/lgpl-2.1.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#include \"WinResrc.h\" //\"afxres.h\"\n\n#define INC_DYNAUDNORM_VERSION_INTERNAL 0x22b4f8a9\n#include \"../DynamicAudioNormalizerShared/res/version.inc\"\n\n//////////////////////////////////////////////////////////////////////////////////\n// Neutral resources\n//////////////////////////////////////////////////////////////////////////////////\n\n#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)\n#ifdef _WIN32\nLANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL\n#pragma code_page(1252)\n#endif //_WIN32\n\n//////////////////////////////////////////////////////////////////////////////////\n// Version\n//////////////////////////////////////////////////////////////////////////////////\n\nVS_VERSION_INFO VERSIONINFO\n FILEVERSION    VER_DYNAUDNORM_MAJOR,VER_DYNAUDNORM_MINOR_HI,VER_DYNAUDNORM_MINOR_LO,VER_DYNAUDNORM_PATCH\n PRODUCTVERSION VER_DYNAUDNORM_MAJOR,VER_DYNAUDNORM_MINOR_HI,VER_DYNAUDNORM_MINOR_LO,VER_DYNAUDNORM_PATCH\n FILEFLAGSMASK 0x17L\n#ifdef _DEBUG\n FILEFLAGS 0x3L\n#else\n FILEFLAGS 0x2L\n#endif\n FILEOS 0x40004L\n FILETYPE 0x2L\n FILESUBTYPE 0x0L\nBEGIN\n    BLOCK \"StringFileInfo\"\n    BEGIN\n        BLOCK \"000004b0\"\n        BEGIN\n            VALUE \"Comments\", \"This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License <http://www.gnu.org/>.\"\n            VALUE \"CompanyName\", \"LoRd_MuldeR <mulder2@gmx.de>\"\n            VALUE \"FileDescription\", \"DynamicAudioNormalizer Python Wrapper\"\n            VALUE \"FileVersion\", VER_DYNAUDNORM_STR\n            VALUE \"InternalName\", \"DynamicAudioNormalizerPYD\"\n            VALUE \"LegalCopyright\", \"Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>\"\n            VALUE \"LegalTrademarks\", \"This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License <http://www.gnu.org/>\"\n            VALUE \"OriginalFilename\", \"DynamicAudioNormalizerPYD.dll\"\n            VALUE \"ProductName\", \"DynamicAudioNormalizer\"\n            VALUE \"ProductVersion\", VER_DYNAUDNORM_STR\n        END\n    END\n    BLOCK \"VarFileInfo\"\n    BEGIN\n        VALUE \"Translation\", 0x0, 1200\n    END\nEND\n\n#endif    // Neutral resources\n"
  },
  {
    "path": "DynamicAudioNormalizerPYD/samples/DynamicAudioNormalizerExample.py",
    "content": "##################################################################################\n# Dynamic Audio Normalizer - Python Wrapper\n# Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n# THE SOFTWARE.\n#\n# http://opensource.org/licenses/MIT\n##################################################################################\n\n#import stdlib modules\nimport sys\nimport os\nimport datetime\nimport array\n\n#import PyDynamicAudioNormalizer\nfrom DynamicAudioNormalizer import PyDynamicAudioNormalizer\n\n#import Wave Reader and Writer\nfrom WaveFileUtils import WaveFileReader\nfrom WaveFileUtils import WaveFileWriter\n\n\n#----------------------------------------------------------------------\n# Utility Functions\n#----------------------------------------------------------------------\n\ndef alloc_sample_buffers(channles, length):\n\tbuffers = ()\n\tfor i in range(0, channles):\n\t\tarr = array.array('d')\n\t\tfor j in range(0, length):\n\t\t\tarr.append(0.0)\n\t\tbuffers += (arr,)\n\treturn buffers\n\n\n#----------------------------------------------------------------------\n# Logging Callback\n#----------------------------------------------------------------------\n\nlogfile = None\n\ndef my_log_func(level, message):\n\tif logfile:\n\t\tlogfile.write(\"[{}][{}] {}\\n\".format(datetime.datetime.utcnow().isoformat(), int(level), message))\n\t\tlogfile.flush()\n\n\n#----------------------------------------------------------------------\n# Processing Loop\n#----------------------------------------------------------------------\n\ndef normalize_samples(wav_reader, wav_writer, logfile, config):\n\tprint(\" Done!\\nInitializing...\", end = '', flush = True)\n\tif logfile:\n\t\tPyDynamicAudioNormalizer.setLogFunction(my_log_func)\n\twith PyDynamicAudioNormalizer(wav_reader.getChannels(), wav_reader.getSamplerate(), *config) as normalizer:\n\t\tindicator, buffersIn, buffersOut = 0, alloc_sample_buffers(wav_reader.getChannels(), 4096), alloc_sample_buffers(wav_reader.getChannels(), 4096)\n\t\tprint(\" Done!\\nProcessing audio samples...\", end = '', flush = True)\n\t\twhile True:\n\t\t\tcount = wav_reader.read(buffersIn)\n\t\t\tif count:\n\t\t\t\tcount = normalizer.process(buffersIn, buffersOut, count)\n\t\t\t\tif count:\n\t\t\t\t\twav_writer.write(buffersOut, count)\n\t\t\t\tindicator += 1\n\t\t\t\tif indicator >= 7:\n\t\t\t\t\tprint('.', end = '', flush = True)\n\t\t\t\t\tindicator = 0\n\t\t\t\tcontinue\n\t\t\tbreak;\n\t\tprint(\" Done!\\nFlushing buffers...\", end = '', flush = True)\n\t\twhile True:\n\t\t\tcount = normalizer.flushBuffer(buffersOut)\n\t\t\tif count:\n\t\t\t\twav_writer.write(buffersOut, count)\n\t\t\t\tindicator += 1\n\t\t\t\tif indicator >= 7:\n\t\t\t\t\tprint('.', end = '', flush = True)\n\t\t\t\t\tindicator = 0\n\t\t\t\tcontinue\n\t\t\tbreak;\n\t\tprint(' Done!\\n')\n\n\n#----------------------------------------------------------------------\n# Main\n#----------------------------------------------------------------------\n\nversion = PyDynamicAudioNormalizer.getVersion()\nprint(\"Dynamic Audio Normalizer, Version {}.{}-{} [{}]\".format(*version[0], version[1][4]))\nprint(\"Copyright (c) 2014-{} LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\".format(version[1][0][7:]))\nprint(\"Built on {} at {} with {} for Python-{}.\\n\".format(*version[1]))\n\nif (len(sys.argv) >= 5):\n\tconfig = (int(sys.argv[1]), int(sys.argv[2]))\n\tsource_file = os.path.abspath(sys.argv[3])\n\toutput_file = os.path.abspath(sys.argv[4])\nelif (len(sys.argv) >= 4):\n\tconfig = (int(sys.argv[1]),)\n\tsource_file = os.path.abspath(sys.argv[2])\n\toutput_file = os.path.abspath(sys.argv[3])\nelif (len(sys.argv) >= 3):\n\tconfig = ()\n\tsource_file = os.path.abspath(sys.argv[1])\n\toutput_file = os.path.abspath(sys.argv[2])\nelse:\n\tprint(\"Usage:\\n  {} {} [[<filterSize>] frameLen] <input.wav> <output.wav>\\n\".format(os.path.basename(sys.executable), os.path.basename(__file__)), file=sys.stderr)\n\tsys.exit(1)\n\nif not os.path.isfile(source_file):\n\tprint(\"Input file \\\"{}\\\" not found!\\n\".format(source_file), file=sys.stderr)\n\tsys.exit(1)\n\nprint(\"Source file: \\\"{}\\\"\".format(source_file))\nprint(\"Output file: \\\"{}\\\"\".format(output_file))\n\nlogfilePath = os.environ.get('LOGFILE') \nif logfilePath:\n\tprint(\"Report file: \\\"{}\\\"\".format(logfilePath))\n\tlogfile = open(logfilePath, 'w')\nelse:\n\tlogfile = None\n\nprint(\"\\nOpening input and output files...\", end = '', flush = True)\nwith WaveFileReader(source_file) as wav_reader:\n\twith WaveFileWriter(output_file, wav_reader.getChannels(), wav_reader.getSampleWidth(), wav_reader.getSamplerate()) as wav_writer:\n\t\tnormalize_samples(wav_reader, wav_writer, logfile, config)\n\t\tprint('All is done. Goodbye.')\n\nif logfile:\n\tlogfile.close()\n"
  },
  {
    "path": "DynamicAudioNormalizerPYD/samples/WaveFileUtils.py",
    "content": "##################################################################################\n# Dynamic Audio Normalizer - Python Wrapper\n# Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n# THE SOFTWARE.\n#\n# http://opensource.org/licenses/MIT\n##################################################################################\n\n#import stdlib modules\nimport sys\nimport math\nimport struct\nimport wave\n\n\n#----------------------------------------------------------------------\n# Wave Audio Base\n#----------------------------------------------------------------------\n\nclass _WaveFileBase:\n\t\"\"\"Base class for Wave file sample processing\"\"\"\n\t_THRESHOLD = math.sqrt(2.0)\n\t\n\tdef _unpack_samples(self, samples, buffers, channels, sampwidth):\n\t\tcidx, sidx = 0, 0\n\t\ttype = self._get_sample_type(sampwidth)\n\t\tfor sample in struct.iter_unpack(type[0], samples):\n\t\t\tif type[1] > self._THRESHOLD:\n\t\t\t\tbuffers[cidx][sidx] = float(sample[0]) / float(type[1])\n\t\t\telse:\n\t\t\t\tbuffers[cidx][sidx] = float(sample[0])\n\t\t\tcidx += 1\n\t\t\tif cidx >= channels:\n\t\t\t\tcidx, sidx = 0, sidx + 1\n\t\treturn sidx\n\t\n\tdef _repack_samples(self, buffers, channels, sampwidth, length):\n\t\ttype = self._get_sample_type(sampwidth)\n\t\tsamples = bytearray(channels * length * sampwidth)\n\t\toffset = 0\n\t\tfor sidx in range(0, length):\n\t\t\tfor cidx in range(0, channels):\n\t\t\t\tif type[1] > self._THRESHOLD:\n\t\t\t\t\tvalue = int(round(buffers[cidx][sidx] * type[1]))\n\t\t\t\telse:\n\t\t\t\t\tvalue = buffers[cidx][sidx]\n\t\t\t\tstruct.pack_into(type[0], samples, offset, value)\n\t\t\t\toffset += sampwidth\n\t\treturn samples\n\t\n\tdef _minimum_buff_length(self, buffers):\n\t\tresult = sys.maxsize\n\t\tfor b in buffers:\n\t\t\tresult = min(result, len(b))\n\t\tif result < 1:\n\t\t\traise ValueError(\"Buffer length is zero!\")\n\t\treturn result\n\t\n\tdef _get_sample_type(self, sampwidth):\n\t\tif sampwidth == 2:\n\t\t\treturn ('<h', 0x7FFF)\n\t\telif sampwidth == 4:\n\t\t\treturn ('<f', 1.0)\n\t\telif sampwidth == 8:\n\t\t\treturn ('<d', 1.0)\n\t\telse:\n\t\t\traise ValueError(\"Unknown sample size!\")\n\n\n#----------------------------------------------------------------------\n# Wave Audio Writer\n#----------------------------------------------------------------------\n\nclass WaveFileReader(_WaveFileBase):\n\t\"\"\"Helper class to read samples from Wave file\"\"\"\n\t\n\tdef __init__(self,filename):\n\t\tself._filename = filename\n\t\tself._wavefile = None\n\t\tself._channels = None\n\t\tself._samplewidth = None\n\t\tself._samplerate = None\n\t\n\tdef __enter__(self):\n\t\tself._wavefile = wave.open(self._filename, 'rb')\n\t\tif self._wavefile:\n\t\t\tself._channels = self._wavefile.getnchannels()\n\t\t\tself._samplewidth =  self._wavefile.getsampwidth()\n\t\t\tself._samplerate = self._wavefile.getframerate()\n\t\treturn self\n\t\n\tdef __exit__(self, type, value, traceback):\n\t\tif not self._wavefile:\n\t\t\traise RuntimeError(\"Instance not initialized!\")\n\t\tself._wavefile.close()\n\t\tself._wavefile = None\n\t\tself._channels = None\n\t\tself._samplewidth = None\n\t\tself._samplerate = None\n\t\n\tdef __del__(self):\n\t\tif self._wavefile:\n\t\t\tprint(\"RESOURCE LEAK: WaveFileReader object was not de-initialized properly!\", file=sys.stderr)\n\t\t\t\n\tdef getChannels(self):\n\t\tif not self._wavefile:\n\t\t\traise RuntimeError(\"Instance not initialized!\")\n\t\treturn self._channels\n\t\t\n\tdef getSamplerate(self):\n\t\tif not self._wavefile:\n\t\t\traise RuntimeError(\"Instance not initialized!\")\n\t\treturn self._samplerate\n\t\t\n\tdef getSampleWidth(self):\n\t\tif not self._wavefile:\n\t\t\traise RuntimeError(\"Instance not initialized!\")\n\t\treturn self._samplewidth\n\t\t\n\tdef read(self, buffers):\n\t\tif not self._wavefile:\n\t\t\traise RuntimeError(\"Instance not initialized!\")\n\t\tif len(buffers) < self._channels:\n\t\t\traise RuntimeError(\"Number of buffers is insufficient!\")\n\t\tframes = self._wavefile.readframes(self._minimum_buff_length(buffers))\n\t\tif frames:\n\t\t\treturn self._unpack_samples(frames, buffers, self._channels, self._samplewidth)\n\t\treturn None\n\n\n#----------------------------------------------------------------------\n# Wave Audio Writer\n#----------------------------------------------------------------------\n\nclass WaveFileWriter(_WaveFileBase):\n\t\"\"\"Helper class to write samples to Wave file\"\"\"\n\t\n\tdef __init__(self,filename,channels,samplewidth,samplerate):\n\t\tself._filename = filename\n\t\tself._wavefile = None\n\t\tself._channels = channels\n\t\tself._samplewidth = samplewidth\n\t\tself._samplerate = samplerate\n\t\n\tdef __enter__(self):\n\t\tself._wavefile = wave.open(self._filename, 'wb')\n\t\tif self._wavefile:\n\t\t\tself._wavefile.setnchannels(self._channels)\n\t\t\tself._wavefile.setsampwidth(self._samplewidth)\n\t\t\tself._wavefile.setframerate(self._samplerate)\n\t\treturn self\n\t\n\tdef __exit__(self, type, value, traceback):\n\t\tif not self._wavefile:\n\t\t\traise RuntimeError(\"Instance not initialized!\")\n\t\tself._wavefile.close()\n\t\tself._wavefile = None\n\t\tself._channels = None\n\t\tself._samplewidth = None\n\t\tself._samplerate = None\n\t\n\tdef __del__(self):\n\t\tif self._wavefile:\n\t\t\tprint(\"RESOURCE LEAK: WaveFileWriter object was not de-initialized properly!\", file=sys.stderr)\n\t\t\t\n\tdef getChannels(self):\n\t\tif not self._wavefile:\n\t\t\traise RuntimeError(\"Instance not initialized!\")\n\t\treturn self._channels\n\t\t\n\tdef getSamplerate(self):\n\t\tif not self._wavefile:\n\t\t\traise RuntimeError(\"Instance not initialized!\")\n\t\treturn self._samplerate\n\t\t\n\tdef getSampleWidth(self):\n\t\tif not self._wavefile:\n\t\t\traise RuntimeError(\"Instance not initialized!\")\n\t\treturn self._samplewidth\n\t\t\n\tdef write(self, buffers, length):\n\t\tif not self._wavefile:\n\t\t\traise RuntimeError(\"Instance not initialized!\")\n\t\tif len(buffers) < self._channels:\n\t\t\traise RuntimeError(\"Number of buffers is insufficient!\")\n\t\tif length < 1:\n\t\t\traise RuntimeError(\"The given length value is zero!\")\n\t\tif length > self._minimum_buff_length(buffers):\n\t\t\traise RuntimeError(\"Length exceeds size of buffer!\")\n\t\tsamples = self._repack_samples(buffers, self._channels, self._samplewidth, length)\n\t\tif samples:\n\t\t\treturn self._wavefile.writeframes(samples)\n\t\treturn None\n\n"
  },
  {
    "path": "DynamicAudioNormalizerPYD/src/DynamicAudioNormalizerPYD.cpp",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Python Wrapper\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n// http://opensource.org/licenses/MIT\n//////////////////////////////////////////////////////////////////////////////////\n\n//Dynamic Audio Normalizer API\n#include <DynamicAudioNormalizer.h>\n\n//Python API\n#include <Python.h>\n\n//Commons\n#include <Common.h>\n#include <Threads.h>\n\n//Version check\n#if PY_MAJOR_VERSION != 3\n#error Python 3 is reuired for this file to be compiled!\n#endif\n\n//CRT\n#include <unordered_set>\n#include <algorithm>\n#include <stdexcept>\n\n///////////////////////////////////////////////////////////////////////////////\n// Helper Macros\n///////////////////////////////////////////////////////////////////////////////\n\n#define PY_METHOD_DECL(X) PyMethodWrap_##X\n#define PY_METHOD_IMPL(X) static PyObject *PyMethodImpl_##X(PyObject *const self, PyObject *const args)\n\n#define PY_BOOLIFY(X) ((X) ? true : false)\n#define PY_ULONG(X) static_cast<unsigned long>((X))\n\n#define PY_INIT_LNG(X,Y) (((X) && PyLong_Check((X)))  ? ((uint32_t)PyLong_AsUnsignedLong((X)))  : (Y))\n#define PY_INIT_FLT(X,Y) (((X) && PyFloat_Check((X))) ? PyFloat_AsDouble((X))                   : (Y))\n#define PY_INIT_BLN(X,Y) (((X) && PyBool_Check((X)))  ? PY_BOOLIFY(PyObject_IsTrue((X)))        : (Y))\n\n#define PY_EXCEPTION(X) do \\\n{ \\\n\tif (!PyErr_Occurred()) \\\n\t{ \\\n\t\tPyErr_SetString(PyExc_RuntimeError, (X)); \\\n\t} \\\n} \\\nwhile(0)\n\nstatic void PY_FREE(PyObject **const obj)\n{\n\tPy_XDECREF(*obj);\n\t*obj = NULL;\n}\n\n\n///////////////////////////////////////////////////////////////////////////////\n// Logging\n///////////////////////////////////////////////////////////////////////////////\n\nstatic PyObject *g_log_callback = NULL;\nstatic MY_CRITSEC_INIT(g_logging_mutex);\n\nstatic int log_callback_set(PyObject *const callback)\n{\n\tint result = (-1);\n\tif ((callback) && PyCallable_Check(callback))\n\t{\n\t\tMY_CRITSEC_ENTER(g_logging_mutex);\n\t\tresult = (g_log_callback) ? 0 : 1;\n\t\tPY_FREE(&g_log_callback);\n\t\tg_log_callback = callback;\n\t\tPy_INCREF(g_log_callback);\n\t\tMY_CRITSEC_LEAVE(g_logging_mutex);\n\t}\n\treturn result;\n}\n\nstatic void log_callback_invoke(const int logLevel, const char *const message)\n{\n\tPyObject *callback;\n\tMY_CRITSEC_ENTER(g_logging_mutex);\n\tcallback = g_log_callback;\n\tMY_CRITSEC_LEAVE(g_logging_mutex);\n\n\tif (callback)\n\t{\n\t\tif (PyObject *const result = PyObject_CallFunction(callback, \"is\", logLevel, message))\n\t\t{\n\t\t\tPy_DECREF(result); /*discard result*/\n\t\t}\n\t}\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Global Initialization\n///////////////////////////////////////////////////////////////////////////////\n\nstatic uint64_t g_initialized = 0L;\nstatic MY_CRITSEC_INIT(g_initalization_mutex);\nstatic PyObject *g_arrayClass = NULL;\n\nstatic bool global_init_function(void)\n{\n\tbool success = false;\n\tif (PyObject *const arrayModule = PyImport_ImportModule(\"array\"))\n\t{\n\t\tif (PyObject *arrayClass = PyObject_GetAttrString(arrayModule, \"array\"))\n\t\t{\n\t\t\tif ((success = PyType_Check(arrayClass)))\n\t\t\t{\n\t\t\t\tstd::swap(g_arrayClass, arrayClass);\n\t\t\t}\n\t\t\tPy_XDECREF(arrayClass);\n\t\t}\n\t\tPy_XDECREF(arrayModule);\n\t}\n\treturn success;\n}\n\nstatic bool global_exit_function(void)\n{\n\tlog_callback_set(NULL);\n\tPY_FREE(&g_arrayClass);\n\treturn true;\n}\n\nstatic bool global_init(void)\n{\n\tbool success = false;\n\tMY_CRITSEC_ENTER(g_initalization_mutex);\n\tif ((success = (g_initialized ? true : global_init_function())))\n\t{\n\t\tg_initialized++;\n\t}\n\tMY_CRITSEC_LEAVE(g_initalization_mutex);\n\treturn success;\n}\n\nstatic bool global_exit(void)\n{\n\tbool success = false;\n\tMY_CRITSEC_ENTER(g_initalization_mutex);\n\tif (g_initialized)\n\t{\n\t\tsuccess = (--g_initialized) ? true : global_exit_function();\n\t}\n\tMY_CRITSEC_LEAVE(g_initalization_mutex);\n\treturn success;\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Instance Management\n///////////////////////////////////////////////////////////////////////////////\n\nstatic std::unordered_set<MDynamicAudioNormalizer*> g_instances;\nstatic MY_CRITSEC_INIT(g_instance_mutex);\n\nstatic MDynamicAudioNormalizer *instance_add(MDynamicAudioNormalizer *const instance)\n{\n\tMY_CRITSEC_ENTER(g_instance_mutex);\n\tg_instances.insert(instance);\n\tMY_CRITSEC_LEAVE(g_instance_mutex);\n\treturn instance;\n}\n\nstatic MDynamicAudioNormalizer *instance_remove(MDynamicAudioNormalizer *const instance)\n{\n\tMY_CRITSEC_ENTER(g_instance_mutex);\n\tconst std::unordered_set<MDynamicAudioNormalizer*>::iterator iter = g_instances.find(instance);\n\tif (iter != g_instances.end())\n\t{\n\t\tg_instances.erase(iter);\n\t}\n\tMY_CRITSEC_LEAVE(g_instance_mutex);\n\treturn instance;\n}\n\nstatic bool instance_check(MDynamicAudioNormalizer *const instance)\n{\n\tbool result;\n\tMY_CRITSEC_ENTER(g_instance_mutex);\n\tresult = (g_instances.find(instance) != g_instances.end());\n\tMY_CRITSEC_LEAVE(g_instance_mutex);\n\treturn result;\n}\n\nstatic MDynamicAudioNormalizer *PY2INSTANCE(PyObject *const obj)\n{\n\tif (obj && PyLong_Check(obj))\n\t{\n\t\tif (MDynamicAudioNormalizer *const instance = reinterpret_cast<MDynamicAudioNormalizer*>(PyLong_AsVoidPtr(obj)))\n\t\t{\n\t\t\tif (instance_check(instance))\n\t\t\t{\n\t\t\t\treturn instance;\n\t\t\t}\n\t\t}\n\t}\n\tPY_EXCEPTION(\"Invalid MDynamicAudioNormalizer handle value!\");\n\treturn (NULL);\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Buffer Management\n///////////////////////////////////////////////////////////////////////////////\n\nclass PyBufferWrapper\n{\npublic:\n\tPyBufferWrapper(PyObject *const data, const uint32_t count, const bool writable)\n\t:\n\t\tm_count(count),\n\t\tm_length(UINT32_MAX)\n\t{\n\t\tmemset(m_buffers, 0, sizeof(double*) * MAX_BUFFERS);\n\t\tmemset(m_views, 0, sizeof(Py_buffer) * MAX_BUFFERS);\n\n\t\tif (!((data) && PyTuple_Check(data)))\n\t\t{\n\t\t\tPY_EXCEPTION(\"Input Python object does not appear to be a tuple!\");\n\t\t\tthrow std::invalid_argument(\"Invalid buffer object!\");\n\t\t}\n\t\tif (!((count > 0) && (count <= MAX_BUFFERS) && (static_cast<uint32_t>(PyTuple_Size(data)) >= count)))\n\t\t{\n\t\t\tPY_EXCEPTION(\"Input tuple does not have the required minimum size!\");\n\t\t\tthrow std::invalid_argument(\"Invalid buffer count!\");\n\t\t}\n\n\t\tPyObject *pyArrays[MAX_BUFFERS];\n\t\tfor (uint32_t c = 0; c < count; ++c)\n\t\t{\n\t\t\tif (!(pyArrays[c] = PyTuple_GetItem(data, static_cast<Py_ssize_t>(c))))\n\t\t\t{\n\t\t\t\tPY_EXCEPTION(\"Failed to obtain the n-th element of the given input tuple!\");\n\t\t\t\tthrow std::invalid_argument(\"PyTuple_GetItem() error!\");\n\t\t\t}\n\t\t\tif (PyObject_IsInstance(pyArrays[c], g_arrayClass) <= 0)\n\t\t\t{\n\t\t\t\tPY_EXCEPTION(\"The n-th element of the given tuple is not an array object!\");\n\t\t\t\tthrow std::invalid_argument(\"PyObject_IsInstance() error!\");\n\t\t\t}\n\t\t}\n\n\t\tfor (uint32_t c = 0; c < count; ++c)\n\t\t{\n\t\t\tif (!PyObject_CheckBuffer(pyArrays[c]))\n\t\t\t{\n\t\t\t\tPY_EXCEPTION(\"The provided array object does not support the 'buffer' protocol!\");\n\t\t\t\treleaseBuffers();\n\t\t\t\tthrow std::invalid_argument(\"PyObject_CheckBuffer() error!\");\n\t\t\t}\n\t\t\tif (PyObject_GetBuffer(pyArrays[c], &m_views[c], (writable ? PyBUF_WRITABLE : 0)) < 0)\n\t\t\t{\n\t\t\t\tPY_EXCEPTION(\"Failed to get the internal buffer from array object!\");\n\t\t\t\treleaseBuffers();\n\t\t\t\tthrow std::invalid_argument(\"PyObject_GetBuffer() error!\");\n\t\t\t}\n\t\t\tif (m_views[c].itemsize != sizeof(double))\n\t\t\t{\n\t\t\t\tPY_EXCEPTION(\"The provided array has an invalid item size! Not 'double' array?\");\n\t\t\t\treleaseBuffers();\n\t\t\t\tthrow std::invalid_argument(\"Py_buffer.itemsize is invalid!\");\n\t\t\t}\n\t\t\tif ((m_length = std::min(m_length, static_cast<uint32_t>(m_views[c].len / m_views[c].itemsize))) < 1)\n\t\t\t{\n\t\t\t\tPY_EXCEPTION(\"The size of the provided buffers is way too small!\");\n\t\t\t\treleaseBuffers();\n\t\t\t\tthrow std::invalid_argument(\"Py_buffer.len is invalid!\");\n\t\t\t}\n\t\t\tif (!(m_buffers[c] = reinterpret_cast<double*>(m_views[c].buf)))\n\t\t\t{\n\t\t\t\tPY_EXCEPTION(\"Pointer to the arrays's buffer appears to be NULL!\");\n\t\t\t\treleaseBuffers();\n\t\t\t\tthrow std::invalid_argument(\"Py_buffer.buf is invalid!\");\n\t\t\t}\n\t\t}\n\t}\n\n\t~PyBufferWrapper(void)\n\t{\n\t\treleaseBuffers();\n\t}\n\n\tuint32_t getLength(void) const\n\t{\n\t\treturn m_length;\n\t}\n\n\tdouble *const *getBuffer(void) const\n\t{\n\t\treturn m_buffers;\n\t}\n\nprivate:\n\tstatic const uint32_t MAX_BUFFERS = 8;\n\tconst uint32_t m_count;\n\tuint32_t m_length;\n\tdouble *m_buffers[MAX_BUFFERS];\n\tPy_buffer m_views[MAX_BUFFERS];\n\n\tvoid releaseBuffers(void)\n\t{\n\t\tfor (uint32_t k = 0; k < m_count; ++k)\n\t\t{\n\t\t\tif ((m_views[k].buf) && (m_views[k].obj))\n\t\t\t{\n\t\t\t\tPyBuffer_Release(&m_views[k]);\n\t\t\t}\n\t\t}\n\n\t\tmemset(m_buffers, 0, sizeof(double*) * MAX_BUFFERS);\n\t\tmemset(m_views, 0, sizeof(Py_buffer) * MAX_BUFFERS);\n\t}\n\n\tPyBufferWrapper& operator=(const PyBufferWrapper&) { throw 666; }\n\tPyBufferWrapper(const PyBufferWrapper&):m_count(0) { throw 666; }\n};\n\n///////////////////////////////////////////////////////////////////////////////\n// Method Implementation\n///////////////////////////////////////////////////////////////////////////////\n\nPY_METHOD_IMPL(CreateInstance)\n{\n\t//Perform gloabl initialization first\n\tif (!global_init())\n\t{\n\t\tPY_EXCEPTION(\"Global library initialization has failed!\");\n\t\treturn (NULL);\n\t}\n\n\t//Unpack the function arguments (references are \"borrowed\"!)\n\tPyObject *pyChannels = NULL, *pySampleRate = NULL, *pyFrameLenMsec = NULL, *pyFilterSize = NULL, *pyPeakValue = NULL, *pyMaxAmplification = NULL, *pyTargetRms = NULL, *pyCompressFactor = NULL, *pyChannelsCoupled = NULL, *pyEnableDCCorrection = NULL, *pyAltBoundaryMode = NULL;\n\tif (!PyArg_UnpackTuple(args, \"create\", 2, 11, &pyChannels, &pySampleRate, &pyFrameLenMsec, &pyFilterSize, &pyPeakValue, &pyMaxAmplification, &pyTargetRms, &pyCompressFactor, &pyChannelsCoupled, &pyEnableDCCorrection, &pyAltBoundaryMode))\n\t{\n\t\tPY_EXCEPTION(\"Failed to unpack MDynamicAudioNormalizer arguments!\");\n\t\tglobal_exit();\n\t\treturn (NULL);\n\t}\n\n\t//Parse the input parameters\n\tconst uint32_t channels           = PY_INIT_LNG(pyChannels,             0L  );\n\tconst uint32_t sampleRate         = PY_INIT_LNG(pySampleRate,           0L  );\n\tconst uint32_t frameLenMsec       = PY_INIT_LNG(pyFrameLenMsec,       500L  );\n\tconst uint32_t filterSize         = PY_INIT_LNG(pyFilterSize,          31L  );\n\tconst double   peakValue          = PY_INIT_FLT(pyPeakValue,            0.95);\n\tconst double   maxAmplification   = PY_INIT_FLT(pyMaxAmplification,    10.  );\n\tconst double   targetRms          = PY_INIT_FLT(pyTargetRms,            0.  );\n\tconst double   compressFactor     = PY_INIT_FLT(pyCompressFactor,       0.  );\n\tconst bool     channelsCoupled    = PY_INIT_BLN(pyChannelsCoupled ,     true);\n\tconst bool     enableDCCorrection = PY_INIT_BLN(pyEnableDCCorrection,  false);\n\tconst bool     altBoundaryMode    = PY_INIT_BLN(pyAltBoundaryMode,     false);\n\n\t//Validate parameters\n\tif (PyErr_Occurred() || (!channels) || (!sampleRate))\n\t{\n\t\tPY_EXCEPTION(\"Invalid or incomplete MDynamicAudioNormalizer arguments!\");\n\t\tglobal_exit();\n\t\treturn (NULL);\n\t}\n\n\t//Create and initialize the instance\n\tif (MDynamicAudioNormalizer *const instance = new MDynamicAudioNormalizer(channels, sampleRate, frameLenMsec, filterSize, peakValue, maxAmplification, targetRms, compressFactor, channelsCoupled, enableDCCorrection, altBoundaryMode))\n\t{\n\t\tif (instance->initialize())\n\t\t{\n\t\t\treturn PyLong_FromVoidPtr(instance_add(instance));\n\t\t}\n\t\tPY_EXCEPTION(\"Failed to initialize MDynamicAudioNormalizer instance!\");\n\t\tdelete instance;\n\t}\n\n\t//Failure\n\tPY_EXCEPTION(\"Failed to create MDynamicAudioNormalizer instance!\");\n\tglobal_exit();\n\treturn (NULL);\n}\n\nPY_METHOD_IMPL(DestroyInstance)\n{\n\tif (MDynamicAudioNormalizer *const instance = PY2INSTANCE(args))\n\t{\n\t\tdelete instance_remove(instance);\n\t\tglobal_exit();\n\t\tPy_RETURN_TRUE;\n\t}\n\tPY_EXCEPTION(\"Failed to destory MDynamicAudioNormalizer instance!\");\n\treturn (NULL);\n}\n\nPY_METHOD_IMPL(GetConfiguration)\n{\n\tif (MDynamicAudioNormalizer *const instance = PY2INSTANCE(args))\n\t{\n\t\tuint32_t channels, sampleRate, frameLen, filterSize;\n\t\tif (instance->getConfiguration(channels, sampleRate, frameLen, filterSize))\n\t\t{\n\t\t\tif (PyObject *const result = Py_BuildValue(\"kkkk\", PY_ULONG(channels), PY_ULONG(sampleRate), PY_ULONG(frameLen), PY_ULONG(filterSize)))\n\t\t\t{\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t}\n\tPY_EXCEPTION(\"Failed to get MDynamicAudioNormalizer configuration!\");\n\treturn (NULL);\n}\n\nPY_METHOD_IMPL(GetInternalDelay)\n{\n\tif (MDynamicAudioNormalizer *const instance = PY2INSTANCE(args))\n\t{\n\t\tint64_t delayInSamples;\n\t\tif (instance->getInternalDelay(delayInSamples))\n\t\t{\n\t\t\treturn PyLong_FromLongLong(static_cast<long long>(delayInSamples));\n\t\t}\n\t}\n\tPY_EXCEPTION(\"Failed to get MDynamicAudioNormalizer internal delay!\");\n\treturn (NULL);\n}\n\nPY_METHOD_IMPL(ProcessInplace)\n{\n\tlong long inputSize = -1LL;\n\tPyObject *pyInstance = NULL, *pySamplesInOut = NULL;\n\n\tif (!PyArg_ParseTuple(args, \"OOK\", &pyInstance, &pySamplesInOut, &inputSize))\n\t{\n\t\treturn NULL;\n\t}\n\n\tif (MDynamicAudioNormalizer *const instance = PY2INSTANCE(pyInstance))\n\t{\n\t\tuint32_t channels, ignored[3];\n\t\tif (!instance->getConfiguration(channels, ignored[0], ignored[1], ignored[2]))\n\t\t{\n\t\t\tPY_EXCEPTION(\"Failed to get number of channels from instance!\");\n\t\t\treturn (NULL);\n\t\t}\n\t\ttry\n\t\t{\n\t\t\tPyBufferWrapper samplesInOut(pySamplesInOut, channels, true);\n\t\t\tif (static_cast<uint64_t>(inputSize) > static_cast<uint64_t>(samplesInOut.getLength()))\n\t\t\t{\n\t\t\t\tPY_EXCEPTION(\"Specified input size exceeds the size of the given array!\");\n\t\t\t\treturn (NULL);\n\t\t\t}\n\t\t\tint64_t outputSize;\n\t\t\tif(instance->processInplace(samplesInOut.getBuffer(), static_cast<uint64_t>(inputSize), outputSize))\n\t\t\t{\n\t\t\t\treturn PyLong_FromLongLong(static_cast<long long>(outputSize));\n\t\t\t}\n\t\t}\n\t\tcatch (const std::invalid_argument&)\n\t\t{\n\t\t\tPY_EXCEPTION(\"Failed to get buffers from inpout arrays!\");\n\t\t\treturn (NULL);\n\t\t}\n\t}\n\n\tPY_EXCEPTION(\"Failed to process audio samples in-place!\");\n\treturn (NULL);\n}\n\nPY_METHOD_IMPL(Process)\n{\n\tlong long inputSize = -1LL;\n\tPyObject *pyInstance = NULL, *pySamplesIn = NULL, *pySamplesOut = NULL;\n\n\tif (!PyArg_ParseTuple(args, \"OOOK\", &pyInstance, &pySamplesIn, &pySamplesOut, &inputSize))\n\t{\n\t\treturn NULL;\n\t}\n\n\tif (MDynamicAudioNormalizer *const instance = PY2INSTANCE(pyInstance))\n\t{\n\t\tuint32_t channels, ignored[3];\n\t\tif (!instance->getConfiguration(channels, ignored[0], ignored[1], ignored[2]))\n\t\t{\n\t\t\tPY_EXCEPTION(\"Failed to get number of channels from instance!\");\n\t\t\treturn (NULL);\n\t\t}\n\t\ttry\n\t\t{\n\t\t\tPyBufferWrapper samplesIn(pySamplesIn, channels, false);\n\t\t\tif (static_cast<uint64_t>(inputSize) > static_cast<uint64_t>(samplesIn.getLength()))\n\t\t\t{\n\t\t\t\tPY_EXCEPTION(\"Specified input size exceeds the size of the given array!\");\n\t\t\t\treturn (NULL);\n\t\t\t}\n\t\t\tPyBufferWrapper samplesOut(pySamplesOut, channels, true);\n\t\t\tif (static_cast<uint64_t>(inputSize) > static_cast<uint64_t>(samplesOut.getLength()))\n\t\t\t{\n\t\t\t\tPY_EXCEPTION(\"Specified input size exceeds the size of the given array!\");\n\t\t\t\treturn (NULL);\n\t\t\t}\n\t\t\tint64_t outputSize;\n\t\t\tif (instance->process(samplesIn.getBuffer(), samplesOut.getBuffer(), static_cast<uint64_t>(inputSize), outputSize))\n\t\t\t{\n\t\t\t\treturn PyLong_FromLongLong(static_cast<long long>(outputSize));\n\t\t\t}\n\t\t}\n\t\tcatch (const std::invalid_argument&)\n\t\t{\n\t\t\tPY_EXCEPTION(\"Failed to get buffers from inpout arrays!\");\n\t\t\treturn (NULL);\n\t\t}\n\t}\n\n\tPY_EXCEPTION(\"Failed to process audio samples in-place!\");\n\treturn (NULL);\n}\n\nPY_METHOD_IMPL(FlushBuffer)\n{\n\tPyObject *pyInstance = NULL, *pySamplesOut = NULL;\n\n\tif (!PyArg_ParseTuple(args, \"OO\", &pyInstance, &pySamplesOut))\n\t{\n\t\treturn NULL;\n\t}\n\n\tif (MDynamicAudioNormalizer *const instance = PY2INSTANCE(pyInstance))\n\t{\n\t\tuint32_t channels, ignored[3];\n\t\tif (!instance->getConfiguration(channels, ignored[0], ignored[1], ignored[2]))\n\t\t{\n\t\t\tPY_EXCEPTION(\"Failed to get number of channels from instance!\");\n\t\t\treturn (NULL);\n\t\t}\n\t\ttry\n\t\t{\n\t\t\tPyBufferWrapper samplesOut(pySamplesOut, channels, true);\n\t\t\tint64_t outputSize;\n\t\t\tif (instance->flushBuffer(samplesOut.getBuffer(), samplesOut.getLength(), outputSize))\n\t\t\t{\n\t\t\t\treturn PyLong_FromLongLong(static_cast<long long>(outputSize));\n\t\t\t}\n\t\t}\n\t\tcatch (const std::invalid_argument&)\n\t\t{\n\t\t\tPY_EXCEPTION(\"Failed to get buffers from inpout arrays!\");\n\t\t\treturn (NULL);\n\t\t}\n\t}\n\n\tPY_EXCEPTION(\"Failed to process audio samples in-place!\");\n\treturn (NULL);\n}\n\nPY_METHOD_IMPL(SetLogFunction)\n{\n\tconst int result = log_callback_set(args);\n\tif (result >= 0)\n\t{\n\t\tif (result > 0)\n\t\t{\n\t\t\tMDynamicAudioNormalizer::setLogFunction(log_callback_invoke);\n\t\t}\n\t\tPy_RETURN_TRUE;\n\t}\n\n\tPY_EXCEPTION(\"Given argument doesn't appear to be callable!\");\n\treturn (NULL);\n}\n\nPY_METHOD_IMPL(GetVersionInfo)\n{\n\tconst char *date, *time, *compiler, *arch;\n\tuint32_t versionMajor, versionMinor, versionPatch;\n\tbool debug;\n\n\tMDynamicAudioNormalizer::getVersionInfo(versionMajor, versionMinor, versionPatch);\n\tMDynamicAudioNormalizer::getBuildInfo(&date, &time, &compiler, &arch, debug);\n\n\tPyObject *const pyVersionInfo = Py_BuildValue(\"III\", static_cast<unsigned int>(versionMajor), static_cast<unsigned int>(versionMinor), static_cast<unsigned int>(versionPatch));\n\tPyObject *const pyBuildInfo   = Py_BuildValue(\"sssss\", date, time, compiler, arch, debug ? \"DEBUG\" : \"RELEASE\");\n\n\tPyObject *result = NULL;\n\tif ((pyVersionInfo) && (pyBuildInfo))\n\t{\n\t\tresult = PyTuple_Pack(2, pyVersionInfo, pyBuildInfo);\n\t}\n\n\tPy_XDECREF(pyVersionInfo);\n\tPy_XDECREF(pyBuildInfo);\n\n\treturn result;\n}\n\nPY_METHOD_IMPL(GetCoreVersion)\n{\n\treturn PyLong_FromUnsignedLong(static_cast<unsigned long>(MDYNAMICAUDIONORMALIZER_CORE));\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Method Wrappers\n///////////////////////////////////////////////////////////////////////////////\n\n#define PY_METHOD_WRAP(X) \\\nstatic PyObject *PyMethodWrap_##X(PyObject *const self, PyObject *const args) \\\n{ \\\n\ttry \\\n\t{ \\\n\t\treturn PyMethodImpl_##X(self, args); \\\n\t} \\\n\tcatch (...) \\\n\t{ \\\n\t\tPyErr_SetString(PyExc_SystemError, \"Internal C++ exception error!\"); \\\n\t\treturn NULL; \\\n\t} \\\n}\n\nPY_METHOD_WRAP(CreateInstance)\nPY_METHOD_WRAP(DestroyInstance)\nPY_METHOD_WRAP(GetConfiguration)\nPY_METHOD_WRAP(GetInternalDelay)\nPY_METHOD_WRAP(Process)\nPY_METHOD_WRAP(ProcessInplace)\nPY_METHOD_WRAP(FlushBuffer)\nPY_METHOD_WRAP(SetLogFunction)\nPY_METHOD_WRAP(GetVersionInfo)\nPY_METHOD_WRAP(GetCoreVersion)\n\n///////////////////////////////////////////////////////////////////////////////\n// Module Definition\n///////////////////////////////////////////////////////////////////////////////\n\nstatic PyMethodDef DynamicAudioNormalizer_Methods[] =\n{\n\t{ \"createInstance\",   PY_METHOD_DECL(CreateInstance),   METH_VARARGS,  \"Create a new MDynamicAudioNormalizer instance and initialize it.\"         },\n\t{ \"destroyInstance\",  PY_METHOD_DECL(DestroyInstance),  METH_O,        \"Destroy an existing MDynamicAudioNormalizer instance.\"                    },\n\t{ \"getConfiguration\", PY_METHOD_DECL(GetConfiguration), METH_O,        \"Get the configuration of an existing MDynamicAudioNormalizer instance.\"   },\n\t{ \"getInternalDelay\", PY_METHOD_DECL(GetInternalDelay), METH_O,        \"Get the internal delay of an existing MDynamicAudioNormalizer instance.\"  },\n\t{ \"processInplace\",   PY_METHOD_DECL(ProcessInplace),   METH_VARARGS,  \"Process next chunk audio samples, in-place.\"                              },\n\t{ \"process\",          PY_METHOD_DECL(Process),          METH_VARARGS,  \"Process next chunk audio samples, out-of-place.\" },\n\t{ \"flushBuffer\",      PY_METHOD_DECL(FlushBuffer),      METH_VARARGS,  \"Flushes pending samples out of the MDynamicAudioNormalizer instance.\"     },\n\t{ \"setLogFunction\",   PY_METHOD_DECL(SetLogFunction),   METH_O,        \"Set the callback function for log messages. This is a \\\"static\\\" method.\" },\n\t{ \"getVersionInfo\",   PY_METHOD_DECL(GetVersionInfo),   METH_NOARGS,   \"Returns version and build info. This is a \\\"static\\\" method.\"             },\n\t{ \"getCoreVersion\",   PY_METHOD_DECL(GetCoreVersion),   METH_NOARGS,   \"Returns the API version. This is a \\\"static\\\" method.\"                    },\n\t{ NULL, NULL, 0, NULL }\n};\n\nstatic struct PyModuleDef PyDynamicAudioNormalizer_ModuleDef =\n{\n\tPyModuleDef_HEAD_INIT, \"DynamicAudioNormalizerPYD\", \"\", -1, DynamicAudioNormalizer_Methods\n};\n\n#ifdef __GNUC__\n#pragma GCC visibility push(default)\n#endif //__GNUC__\n\nPyMODINIT_FUNC PyInit_DynamicAudioNormalizerPYD(void)\n{\n\treturn PyModule_Create(&PyDynamicAudioNormalizer_ModuleDef);\n}\n\n#ifdef __GNUC__\n#pragma GCC visibility pop\n#endif //__GNUC__\n"
  },
  {
    "path": "DynamicAudioNormalizerShared/include/Common.h",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Library\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This library is free software; you can redistribute it and/or\n// modify it under the terms of the GNU Lesser General Public\n// License as published by the Free Software Foundation; either\n// version 2.1 of the License, or (at your option) any later version.\n//\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public\n// License along with this library; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n//\n// http://www.gnu.org/licenses/lgpl-2.1.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#pragma once\n\n#if defined(_DEBUG) && !defined(NDEBUG)\n\t#define DYNAUDNORM_DEBUG (1)\n#elif defined(NDEBUG) &&  !defined(_DEBUG)\n\t#define DYNAUDNORM_DEBUG (0)\n#else\n\t#error Inconsistent debug defines detected!\n#endif\n\n#define DYNAUDNORM_NS MDynamicAudioNormalizer_InternalStuff\n\n#define MY_DELETE(X) do \\\n{ \\\n\tif((X)) \\\n\t{ \\\n\t\tdelete (X); \\\n\t\t(X) = NULL; \\\n\t} \\\n} \\\nwhile(0)\n\n#define MY_DELETE_ARRAY(X) do \\\n{ \\\n\tif((X)) \\\n\t{ \\\n\t\tdelete [] (X); \\\n\t\t(X) = NULL; \\\n\t} \\\n} \\\nwhile(0)\n\n#define MY_FREE(X) do \\\n{ \\\n\tif((X)) \\\n\t{ \\\n\t\tfree(X); \\\n\t\t(X) = NULL; \\\n\t} \\\n} \\\nwhile(0)\n"
  },
  {
    "path": "DynamicAudioNormalizerShared/include/Threads.h",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Library\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This library is free software; you can redistribute it and/or\n// modify it under the terms of the GNU Lesser General Public\n// License as published by the Free Software Foundation; either\n// version 2.1 of the License, or (at your option) any later version.\n//\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public\n// License along with this library; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n//\n// http://www.gnu.org/licenses/lgpl-2.1.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#pragma once\n\n#if (defined(__cplusplus) && (__cplusplus >= 201103L)) || (defined(_MSC_VER) && (_MSC_VER >= 1800))\n#define HAVE_STDC11_MUTEX_SUPPORT 1\n#else\n#define HAVE_STDC11_MUTEX_SUPPORT 0\n#endif\n\n// ----------------------------------------------\n// C++11 Mutex\n// ----------------------------------------------\n\n#if(HAVE_STDC11_MUTEX_SUPPORT)\n\n//Std mutex\n#include <mutex>\n\n//Init\n#define MY_CRITSEC_DECL(X) std::mutex X\n#define MY_CRITSEC_INIT(X) std::mutex X\n\n//Functions\n#define MY_CRITSEC_ENTER(X) (X).lock()\n#define MY_CRITSEC_LEAVE(X) (X).unlock()\n\n// ----------------------------------------------\n// Pthread Mutex\n// ----------------------------------------------\n\n#else //HAVE_STDC11_MUTEX_SUPPORT\n\n//Static lib support\n#if defined(_WIN32) && defined(_MT)\n#define PTW32_STATIC_LIB 1\n#endif\n\n//VS2015 compile fix\n#if (_MSC_VER >= 1900) && !defined(_CRT_NO_TIME_T)\n#define _TIMESPEC_DEFINED 1\n#endif\n\n//PThread\n#include <pthread.h>\n\n//Init\n#define MY_CRITSEC_DECL(X) pthread_mutex_t X\n#define MY_CRITSEC_INIT(X) pthread_mutex_t X = PTHREAD_MUTEX_INITIALIZER\n\n//Lock\n#define MY_CRITSEC_ENTER(X) do \\\n{ \\\n\tif(pthread_mutex_lock(&(X)) != 0) \\\n\t{ \\\n\t\tabort(); \\\n\t} \\\n} \\\nwhile(0)\n\n//Un-lock\n#define MY_CRITSEC_LEAVE(X) do \\\n{ \\\n\tif(pthread_mutex_unlock(&(X)) != 0) \\\n\t{ \\\n\t\tabort(); \\\n\t} \\\n} \\\nwhile(0)\n\n#endif //HAVE_STDC11_MUTEX_SUPPORT"
  },
  {
    "path": "DynamicAudioNormalizerShared/res/compat.manifest",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\"><compatibility xmlns=\"urn:schemas-microsoft-com:compatibility.v1\"><application><supportedOS Id=\"{e2011457-1546-43c5-a5fe-008deee3d3f0}\"/><supportedOS Id=\"{35138b9a-5d96-4fbd-8e2d-a2440225f93a}\"/><supportedOS Id=\"{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}\"/><supportedOS Id=\"{1f676c76-80e1-4239-95bb-83d0f6d0da78}\"/><supportedOS Id=\"{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}\"/></application></compatibility></assembly>"
  },
  {
    "path": "DynamicAudioNormalizerShared/res/version.inc",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Library\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This library is free software; you can redistribute it and/or\n// modify it under the terms of the GNU Lesser General Public\n// License as published by the Free Software Foundation; either\n// version 2.1 of the License, or (at your option) any later version.\n//\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public\n// License along with this library; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n//\n// http://www.gnu.org/licenses/lgpl-2.1.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#if INC_DYNAUDNORM_VERSION_INTERNAL != 0x22b4f8a9\n#error \"Please do *not* include this file directly; include 'Version.h' instead!\"\n#endif\n\n//////////////////////////////////////////////////////////////////////////////////\n// Version Info\n//////////////////////////////////////////////////////////////////////////////////\n\n#define VER_DYNAUDNORM_MAJOR      2\n#define VER_DYNAUDNORM_MINOR_HI   1\n#define VER_DYNAUDNORM_MINOR_LO   1\n#define VER_DYNAUDNORM_PATCH      1\n\n//////////////////////////////////////////////////////////////////////////////////\n// Helper macros (aka: having fun with the C pre-processor)\n//////////////////////////////////////////////////////////////////////////////////\n\n#define ___VER_DYNAUDNORM_STR___(X)       #X\n#define __VER_DYNAUDNORM_STR__(W,X,Y,Z)   ___VER_DYNAUDNORM_STR___(v##W.X##Y-Z)\n#define _VER_DYNAUDNORM_STR_(W,X,Y,Z)     __VER_DYNAUDNORM_STR__(W,X,Y,Z)\n#define VER_DYNAUDNORM_STR                _VER_DYNAUDNORM_STR_(VER_DYNAUDNORM_MAJOR,VER_DYNAUDNORM_MINOR_HI,VER_DYNAUDNORM_MINOR_LO,VER_DYNAUDNORM_PATCH)\n\n#define __VER_DYNAUDNORM_MINOR__(X,Y)     ((10U * (X)) + (Y))\n#define _VER_DYNAUDNORM_MINOR_(X,Y)       __VER_DYNAUDNORM_MINOR__(X,Y)\n#define VER_DYNAUDNORM_MINOR              _VER_DYNAUDNORM_MINOR_(VER_DYNAUDNORM_MINOR_HI,VER_DYNAUDNORM_MINOR_LO)\n"
  },
  {
    "path": "DynamicAudioNormalizerSoX/DynamicAudioNormalizerSoX.c",
    "content": "/* ================================================================================== */\n/* Dynamic Audio Normalizer - SoX Effect Wrapper                                      */\n/* Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.        */\n/*                                                                                    */\n/* Permission is hereby granted, free of charge, to any person obtaining a copy       */\n/* of this software and associated documentation files (the \"Software\"), to deal      */\n/* in the Software without restriction, including without limitation the rights       */\n/* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell          */\n/* copies of the Software, and to permit persons to whom the Software is              */\n/* furnished to do so, subject to the following conditions:                           */\n/*                                                                                    */\n/* The above copyright notice and this permission notice shall be included in         */\n/* all copies or substantial portions of the Software.                                */\n/*                                                                                    */\n/* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR         */\n/* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,           */\n/* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE        */\n/* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER             */\n/* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,      */\n/* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN          */\n/* THE SOFTWARE.                                                                      */\n/*                                                                                    */\n/* http://opensource.org/licenses/MIT                                                 */\n/* ================================================================================== */\n\n/*Shut up warnings*/\n#define _CRT_SECURE_NO_WARNINGS\n\n/*printf() macros*/\n#ifndef __STDC_FORMAT_MACROS\n#define __STDC_FORMAT_MACROS 1\n#endif\n\n/*SoX internal stuff*/\n#include \"sox_i.h\"\n\n/*Win32 Unicode support*/\n#ifdef _WIN32\n#include \"unicode_support.h\"\n#else\n#define lsx_fopen(X,Y) fopen((X),(Y))\n#endif /*_WIN32*/\n\n/*StdLib*/\n#include <string.h>\n#include <stdarg.h>\n#include <ctype.h>\n#include <inttypes.h>\n\n/*Linkage*/\n#if defined(_MSC_VER) && defined(_MT)\n#define MDYNAMICAUDIONORMALIZER_STATIC\nstatic const char *LINKAGE = \"Static\";\n#else\nstatic const char *LINKAGE = \"Shared\";\n#endif\n\n/*Dynamic Audio Normalizer*/\n#include <DynamicAudioNormalizer.h>\n\n/* ================================================================================== */\n/* Private Data                                                                       */\n/* ================================================================================== */\n\ntypedef struct\n{\n\tuint32_t frameLenMsec;\n\tuint32_t filterSize;\n\tdouble peakValue;\n\tdouble maxAmplification;\n\tdouble targetRms;\n\tdouble compressFactor;\n\tint channelsCoupled;\n\tint enableDCCorrection;\n\tint altBoundaryMode;\n\tFILE *logFile;\n}\nsettings_t;\n\ntypedef struct\n{\n\tsettings_t settings;\n\tMDynamicAudioNormalizer_Handle *instance;\n\tdouble **temp;\n\tsize_t tempSize;\n}\npriv_t;\n\n/* ================================================================================== */\n/* Internal Functions                                                                 */\n/* ================================================================================== */\n\nstatic int parseArgInt(const char *const str, uint32_t *parameter, const uint32_t min_val, const uint32_t max_val)\n{\n\tuint32_t temp;\n\tif(sscanf(str, \"%u\", &temp) == 1)\n\t{\n\t\t*parameter = max(min_val, min(max_val, temp));\n\t\treturn 1;\n\t}\n\tlsx_fail(\"Failed to parse integral value `%s'\", str);\n\treturn 0;\n}\n\nstatic int parseArgDbl(const char *const str, double *parameter, const double min_val, const double max_val)\n{\n\tdouble temp;\n\tif(sscanf(str, \"%lf\", &temp) == 1)\n\t{\n\t\t*parameter = max(min_val, min(max_val, temp));\n\t\treturn 1;\n\t}\n\tlsx_fail(\"Failed to parse floating point value `%s'\", str);\n\treturn 0;\n}\n\n#define TRY_PARSE(TYPE, PARAM, MIN, MAX) do \\\n{ \\\n\tif(!parseArg##TYPE(optstate.arg, &(PARAM), (MIN), (MAX))) \\\n\t{ \\\n\t\treturn 0; \\\n\t} \\\n} \\\nwhile(0)\n\nstatic void dynaudnorm_defaults(settings_t *settings)\n{\n\tmemset(settings, 0, sizeof(settings_t));\n\n\tsettings->frameLenMsec       = 500;\n\tsettings->filterSize         =  31;\n\tsettings->peakValue          =   0.95;\n\tsettings->maxAmplification   =  10.0;\n\tsettings->targetRms          =   0.0;\n\tsettings->compressFactor     =   0.0;\n\tsettings->channelsCoupled    =   1;\n\tsettings->enableDCCorrection =   0;\n\tsettings->altBoundaryMode    =   0;\n}\n\nstatic int dynaudnorm_parse_args(settings_t *settings, int argc, char **argv)\n{\n\tstatic const char *const opts = \"+f:g:p:m:r:ncbs:l:\";\n\tlsx_getopt_t optstate; char c;\n\tlsx_getopt_init(argc, argv, opts, NULL, lsx_getopt_flag_opterr, 1, &optstate);\n\n\twhile((c = lsx_getopt(&optstate)) != -1)\n\t{\n\t\tswitch(tolower(c))\n\t\t{\n\t\tcase 'f':\n\t\t\tTRY_PARSE(Int, settings->frameLenMsec, 10, 8000);\n\t\t\tbreak;\n\t\tcase 'g':\n\t\t\tTRY_PARSE(Int, settings->filterSize, 3, 301);\n\t\t\tsettings->filterSize += ((settings->filterSize + 1) % 2);\n\t\t\tbreak;\n\t\tcase 'p':\n\t\t\tTRY_PARSE(Dbl, settings->peakValue, 0.0, 1.0);\n\t\t\tbreak;\n\t\tcase 'm':\n\t\t\tTRY_PARSE(Dbl, settings->maxAmplification, 1.0, 100.0);\n\t\t\tbreak;\n\t\tcase 'r':\n\t\t\tTRY_PARSE(Dbl, settings->targetRms, 0.0, 1.0);\n\t\t\tbreak;\n\t\tcase 'n':\n\t\t\tsettings->channelsCoupled = 0;\n\t\t\tbreak;\n\t\tcase 'c':\n\t\t\tsettings->enableDCCorrection = 1;\n\t\t\tbreak;\n\t\tcase 'b':\n\t\t\tsettings->altBoundaryMode = 1;\n\t\t\tbreak;\n\t\tcase 's':\n\t\t\tTRY_PARSE(Dbl, settings->compressFactor, 0.0, 30.0);\n\t\t\tbreak;\n\t\tcase 'l':\n\t\t\tif(!settings->logFile)\n\t\t\t{\n\t\t\t\tsettings->logFile = lsx_fopen(optstate.arg, \"w\");\n\t\t\t\tif(!settings->logFile)\n\t\t\t\t{\n\t\t\t\t\tlsx_warn(\"Failed to open logfile `%s'\", optstate.arg);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\treturn 1;\n}\n\nstatic void dynaudnorm_deinterleave(double **temp, const sox_sample_t *const in, const size_t samples_per_channel, const unsigned channels)\n{\n\tsize_t i, c, in_pos = 0;\n\n\tfor(i = 0; i < samples_per_channel; i++)\n\t{\n\t\tfor(c = 0; c < channels; c++)\n\t\t{\n\t\t\ttemp[c][i] = ((double)in[in_pos++]) / ((double)SOX_INT32_MAX);\n\t\t}\n\t}\n}\n\nstatic void dynaudnorm_interleave(sox_sample_t *const out, const double *const *const temp, const size_t samples_per_channel, const unsigned channels)\n{\n\tsize_t i, c, out_pos = 0;\n\n\tfor(i = 0; i < samples_per_channel; i++)\n\t{\n\t\tfor(c = 0; c < channels; c++)\n\t\t{\n\t\t\tout[out_pos++] = (sox_sample_t) round(min(1.0, max(-1.0, temp[c][i])) * ((double)SOX_INT32_MAX));\n\t\t}\n\t}\n}\n\nstatic void dynaudnorm_print(sox_effect_t *effp, const char *const fmt, ...)\n{\n\tif(effp->global_info->global_info->output_message_handler)\n\t{\n\t\tva_list arg_list;\n\t\tva_start(arg_list, fmt);\n\t\tvfprintf(stderr, fmt, arg_list);\n\t\tva_end(arg_list);\n\t}\n}\n\nstatic void dynaudnorm_log(const int logLevel, const char *const message)\n{\n\tswitch(logLevel)\n\t{\n\tcase 0:\n\t\tlsx_report(\"%s\", message);\n\t\tbreak;\n\tcase 1:\n\t\tlsx_warn(\"%s\", message);\n\t\tbreak;\n\tcase 2:\n\t\tlsx_fail(\"%s\", message);\n\t\tbreak;\n\t}\n}\n\nstatic void dynaudnorm_update_buffsize(const sox_effect_t *const effp, priv_t *const p, const size_t input_samples)\n{\n\tsize_t c;\n\tif(input_samples > p->tempSize)\n\t{\n\t\tlsx_warn(\"Increasing buffer size: %\" PRIu64 \" -> %\" PRIu64, (uint64_t)p->tempSize, (uint64_t)input_samples);\n\t\tfor(c = 0; c < effp->in_signal.channels; c++)\n\t\t{\n\t\t\tp->temp[c] = lsx_realloc(p->temp[c], input_samples * sizeof(double));\n\t\t}\n\t\tp->tempSize = input_samples;\n\t}\n}\n\n/* ================================================================================== */\n/* SoX Callback Functions                                                             */\n/* ================================================================================== */\n\nstatic int dynaudnorm_kill(sox_effect_t *effp)\n{\n\tlsx_report(\"dynaudnorm_kill()\");\n\tlsx_report(\"flows=%\" PRIu64 \", flow=%\" PRIu64 , (uint64_t)effp->flows, (uint64_t)effp->flow);\n\treturn SOX_SUCCESS;\n}\n\nstatic int dynaudnorm_create(sox_effect_t *effp, int argc, char **argv)\n{\n\tpriv_t *const p = (priv_t *)effp->priv;\n\n\tlsx_report(\"dynaudnorm_create()\");\n\tlsx_report(\"flows=%\" PRIu64 \", flow=%\" PRIu64 , (uint64_t)effp->flows, (uint64_t)effp->flow);\n\n\tmemset(effp->priv, 0, sizeof(priv_t));\n\tdynaudnorm_defaults(&p->settings);\n\n\tif(!dynaudnorm_parse_args(&p->settings, argc, argv))\n\t{\n\t\treturn lsx_usage(effp);\n\t}\n\n\treturn SOX_SUCCESS;\n}\n\nstatic int dynaudnorm_stop(sox_effect_t *effp)\n{\n\tpriv_t *const p = (priv_t *)effp->priv;\n\tsize_t c;\n\n\tlsx_report(\"dynaudnorm_stop()\");\n\n\tif(p->instance)\n\t{\n\t\tMDYNAMICAUDIONORMALIZER_FUNCTION(destroyInstance)(&p->instance);\n\t\tp->instance = NULL;\n\t}\n\n\tif(p->settings.logFile)\n\t{\n\t\tfclose(p->settings.logFile);\n\t\tp->settings.logFile = NULL;\n\t}\n\n\tif(p->temp)\n\t{\n\t\tfor(c = 0; c < effp->in_signal.channels; c++)\n\t\t{\n\t\t\tfree(p->temp[c]);\n\t\t\tp->temp[c] = NULL;\n\t\t}\n\t\tfree(p->temp);\n\t\tp->temp = NULL;\n\t}\n\n\treturn SOX_SUCCESS;\n}\n\nstatic int dynaudnorm_start(sox_effect_t *effp)\n{\n\tpriv_t *const p = (priv_t *)effp->priv;\n\n\tlsx_report(\"dynaudnorm_start()\");\n\tlsx_report(\"flows=%\" PRIu64 \", flow=%\" PRIu64 \", in_signal.rate=%.2f, in_signal.channels=%\" PRIu64, (uint64_t)effp->flows, (uint64_t)effp->flow, effp->in_signal.rate, (uint64_t)effp->in_signal.channels);\n\n\tif((effp->flow == 0) && (effp->global_info->global_info->verbosity > 1))\n\t{\n\t\tuint32_t versionMajor, versionMinor, versionPatch;\n\t\tconst char *buildDate, *buildTime, *buildCompiler, *buildArch; int buildDebug;\n\n\t\tMDYNAMICAUDIONORMALIZER_FUNCTION(getVersionInfo)(&versionMajor, &versionMinor, &versionPatch);\n\t\tMDYNAMICAUDIONORMALIZER_FUNCTION(getBuildInfo)(&buildDate, &buildTime, &buildCompiler, &buildArch, &buildDebug);\n\n\t\tdynaudnorm_print(effp, \"\\n---------------------------------------------------------------------------\\n\");\n\t\tdynaudnorm_print(effp, \"Dynamic Audio Normalizer (SoX Wrapper), Version %u.%02u-%u, %s\\n\", versionMajor, versionMinor, versionPatch, LINKAGE);\n\t\tdynaudnorm_print(effp, \"Copyright (c) 2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\\n\");\n\t\tdynaudnorm_print(effp, \"Built on %s at %s with %s for %s.\\n\\n\", buildDate, buildTime, buildCompiler, buildArch);\n\t\tdynaudnorm_print(effp, \"This program is free software: you can redistribute it and/or modify\\n\");\n\t\tdynaudnorm_print(effp, \"it under the terms of the GNU General Public License <http://www.gnu.org/>.\\n\");\n\t\tdynaudnorm_print(effp, \"Note that this program is distributed with ABSOLUTELY NO WARRANTY.\\n\");\n\t\tdynaudnorm_print(effp, \"---------------------------------------------------------------------------\\n\\n\");\n\t}\n\n\tp->tempSize = (size_t) max(ceil(effp->in_signal.rate), 8192.0); /*initial buffer size is one second*/\n\n\tp->instance = MDYNAMICAUDIONORMALIZER_FUNCTION(createInstance)\n\t(\n\t\teffp->in_signal.channels,\n\t\t(uint32_t) round(effp->in_signal.rate),\n\t\tp->settings.frameLenMsec,\n\t\tp->settings.filterSize,\n\t\tp->settings.peakValue,\n\t\tp->settings.maxAmplification,\n\t\tp->settings.targetRms,\n\t\tp->settings.compressFactor,\n\t\tp->settings.channelsCoupled,\n\t\tp->settings.enableDCCorrection,\n\t\tp->settings.altBoundaryMode,\n\t\tp->settings.logFile\n\t);\n\n\tif(p->instance)\n\t{\n\t\tsize_t c;\n\t\tp->temp = (double**) lsx_calloc(effp->in_signal.channels, sizeof(double*));\n\t\tfor(c = 0; c < effp->in_signal.channels; c++)\n\t\t{\n\t\t\tp->temp[c] = (double*) lsx_calloc(p->tempSize, sizeof(double));\n\t\t}\n\t}\n\n\treturn (p->instance) ? SOX_SUCCESS : SOX_EINVAL;\n}\n\nstatic int dynaudnorm_flow(sox_effect_t *effp, const sox_sample_t *ibuf, sox_sample_t *obuf, size_t *isamp, size_t *osamp)\n{\n\tpriv_t *const p = (priv_t *)effp->priv;\n\tconst size_t input_samples = min((*isamp), (*osamp)) / effp->in_signal.channels; /*this is per channel!*/\n\tint64_t output_samples = 0;\n\n\tlsx_debug(\"dynaudnorm_flow()\");\n\tdynaudnorm_update_buffsize(effp, p, input_samples);\n\n\tif(input_samples > 0)\n\t{\n\t\tdynaudnorm_deinterleave(p->temp, ibuf, input_samples, effp->in_signal.channels);\n\t\tif(!MDYNAMICAUDIONORMALIZER_FUNCTION(processInplace)(p->instance, p->temp, ((int64_t) input_samples), &output_samples))\n\t\t{\n\t\t\treturn SOX_EOF;\n\t\t}\n\t\tif(output_samples > 0)\n\t\t{\n\t\t\tdynaudnorm_interleave(obuf, ((const double**) p->temp), ((size_t) output_samples), effp->in_signal.channels);\n\t\t}\n\t}\n\n\n\t*isamp = (size_t)(input_samples  * effp->in_signal.channels);\n\t*osamp = (size_t)(output_samples * effp->in_signal.channels);\n\n\treturn SOX_SUCCESS;\n}\n\nstatic int dynaudnorm_drain(sox_effect_t * effp, sox_sample_t * obuf, size_t * osamp)\n{\n\tpriv_t *const p = (priv_t *)effp->priv;\n\tconst size_t input_samples = (*osamp) / effp->in_signal.channels; /*this is per channel!*/\n\tint64_t output_samples = 0;\n\n\tlsx_debug(\"dynaudnorm_drain()\");\n\tdynaudnorm_update_buffsize(effp, p, input_samples);\n\n\tif(input_samples > 0)\n\t{\n\t\tif(!MDYNAMICAUDIONORMALIZER_FUNCTION(flushBuffer)(p->instance, p->temp, ((int64_t) input_samples), &output_samples))\n\t\t{\n\t\t\treturn SOX_EOF;\n\t\t}\n\t\tif(output_samples > 0)\n\t\t{\n\t\t\tdynaudnorm_interleave(obuf, ((const double**) p->temp), ((size_t) output_samples), effp->in_signal.channels);\n\t\t}\n\t}\n\telse\n\t{\n\t\tlsx_warn(\"drain() was called with zero-size output buffer!\");\n\t}\n\n\t*osamp = (size_t)(output_samples * effp->in_signal.channels);\n\treturn SOX_SUCCESS;\n}\n\n/* ================================================================================== */\n/* SoX Public API                                                                     */\n/* ================================================================================== */\n\nsox_effect_handler_t const * lsx_dynaudnorm_effect_fn(void)\n{\n\tstatic sox_effect_handler_t handler =\n\t{\n\t\t\"dynaudnorm\", NULL, SOX_EFF_MCHAN,\n\t\tdynaudnorm_create, dynaudnorm_start, dynaudnorm_flow, dynaudnorm_drain, dynaudnorm_stop, dynaudnorm_kill, sizeof(priv_t)\n\t};\n\n\tstatic char const * lines[] =\n\t{\n\t\t\"[options]\",\n\t\t\"\",\n\t\t\"Algorithm Tweaks:\",\n\t\t\"  -f <value>  Frame length, in milliseconds\",\n\t\t\"  -g <value>  Gauss filter size, in frames\",\n\t\t\"  -p <value>  Target peak magnitude, 0.1-1.0\",\n\t\t\"  -m <value>  Maximum gain factor\",\n\t\t\"  -r <value>  Target RMS value\",\n\t\t\"  -n          Disable channel coupling\",\n\t\t\"  -c          Enable the DC bias correction\",\n\t\t\"  -b          Use alternative boundary mode\",\n\t\t\"  -s <value>  Compress the input data\",\n\t\t\"\",\n\t\t\"Diagnostics:\",\n\t\t\"  -l <file>   Create a log file\",\n\t\t\"\",\n\t\t\"\",\n\t\t\"Please refer to the manual for a detailed explanation!\"\n\t};\n\t\n\tstatic char *usage;\n\thandler.usage = lsx_usage_lines(&usage, lines, array_length(lines));\n\n\tMDYNAMICAUDIONORMALIZER_FUNCTION(setLogFunction)(dynaudnorm_log);\n\treturn &handler;\n}\n"
  },
  {
    "path": "DynamicAudioNormalizerSoX/INFO.txt",
    "content": "Dynamic Audio Normalizer - SoX Wrapper\n======================================\n\nThe purpose of the SoX Wrapper is integrating the Dynamic Audio Normalizer into the SoX (Sound eXchange) application, a versatile audio editor and converter.\n\n\nBuild Instructions\n------------------\n\nHow to build SoX with the Dynamic Audio Normalizer effect:\n\n1. Download the latest SoX sources from the official SoX web-site (http://sox.sourceforge.net/)\n\n2. Use CMake to generate solution/project files, as usually\n\n3. Open the SoX solution and add the provided source code file \"DynamicAudioNormalizerSoX.c\" to the \"libsox\" project\n\n4. In the \"libsox\" project settings, add the directory \"DynamicAudioNormalizerAPI\\include\" to the Additional Include Directories paths\n\n5. In the \"libsox\" project settings, add \"DynamicAudioNormalizerAPI.lib\" to the Additional Dependencies\n\n6. Open the file \"src\\effects.h\" and insert the following line at the suitable position:\n   EFFECT(dynaudnorm)\n\n7. Now (re)build SoX!\n\n\nUsage Instructions\n------------------\n\nWith SoX, the Dynamic Audio Normalizer effect can be invoked like this:\n\n> sox.exe <input_file> <output_file> dynaudnorm [options]\n\n\ne.o.f.\n"
  },
  {
    "path": "DynamicAudioNormalizerSoX/extra/main.c",
    "content": "int main( int argc, char **argv )\n{\n  int sox_argc;\n  char **sox_argv;\n  int exit_code;\n  \n  lsx_init_console();\n  lsx_init_commandline_arguments(&sox_argc, &sox_argv);\n\n  exit_code = sox_main(sox_argc, sox_argv);\n  \n  lsx_uninit_console();\n  lsx_free_commandline_arguments(&sox_argc, &sox_argv);\n\n  return exit_code;\n}\n"
  },
  {
    "path": "DynamicAudioNormalizerSoX/extra/unicode_support.c",
    "content": "/* Copyright (c) 2004-2012 LoRd_MuldeR <mulder2@gmx.de>\n   File: unicode_support.c\n\n   This file was originally part of a patch included with LameXP,\n   released under the same license as the original audio tools.\n\n   Redistribution and use in source and binary forms, with or without\n   modification, are permitted provided that the following conditions\n   are met:\n\n   - Redistributions of source code must retain the above copyright\n   notice, this list of conditions and the following disclaimer.\n\n   - Redistributions in binary form must reproduce the above copyright\n   notice, this list of conditions and the following disclaimer in the\n   documentation and/or other materials provided with the distribution.\n\n   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR\n   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\n#if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64\n\n#include \"unicode_support.h\"\n\n#include <windows.h>\n#include <io.h>\n\nstatic UINT g_old_output_cp = ((UINT)-1);\n\nstatic char *utf16_to_utf8(const wchar_t *input)\n{\n\tchar *Buffer;\n\tint BuffSize = 0, Result = 0;\n\n\tBuffSize = WideCharToMultiByte(CP_UTF8, 0, input, -1, NULL, 0, NULL, NULL);\n\tBuffer = (char*) malloc(sizeof(char) * BuffSize);\n\tif(Buffer)\n\t{\n\t\tResult = WideCharToMultiByte(CP_UTF8, 0, input, -1, Buffer, BuffSize, NULL, NULL);\n\t}\n\n\treturn ((Result > 0) && (Result <= BuffSize)) ? Buffer : NULL;\n}\n\nstatic char *utf16_to_ansi(const wchar_t *input)\n{\n\tchar *Buffer;\n\tint BuffSize = 0, Result = 0;\n\n\tBuffSize = WideCharToMultiByte(CP_ACP, 0, input, -1, NULL, 0, NULL, NULL);\n\tBuffer = (char*) malloc(sizeof(char) * BuffSize);\n\tif(Buffer)\n\t{\n\t\tResult = WideCharToMultiByte(CP_ACP, 0, input, -1, Buffer, BuffSize, NULL, NULL);\n\t}\n\n\treturn ((Result > 0) && (Result <= BuffSize)) ? Buffer : NULL;\n}\n\nstatic wchar_t *utf8_to_utf16(const char *input)\n{\n\twchar_t *Buffer;\n\tint BuffSize = 0, Result = 0;\n\n\tBuffSize = MultiByteToWideChar(CP_UTF8, 0, input, -1, NULL, 0);\n\tBuffer = (wchar_t*) malloc(sizeof(wchar_t) * BuffSize);\n\tif(Buffer)\n\t{\n\t\tResult = MultiByteToWideChar(CP_UTF8, 0, input, -1, Buffer, BuffSize);\n\t}\n\n\treturn ((Result > 0) && (Result <= BuffSize)) ? Buffer : NULL;\n}\n\nvoid lsx_init_commandline_arguments(int *argc, char ***argv)\n{\n\tint i, nArgs;\n\tLPWSTR *szArglist;\n\n\tszArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);\n\n\tif(NULL == szArglist)\n\t{\n\t\tfprintf(stderr, \"\\nFATAL: CommandLineToArgvW failed\\n\\n\");\n\t\texit(-1);\n\t}\n\n\t*argv = (char**) malloc(sizeof(char*) * nArgs);\n\t*argc = nArgs;\n\n\tif(NULL == *argv)\n\t{\n\t\tfprintf(stderr, \"\\nFATAL: Malloc failed\\n\\n\");\n\t\texit(-1);\n\t}\n\t\n\tfor(i = 0; i < nArgs; i++)\n\t{\n\t\t(*argv)[i] = utf16_to_utf8(szArglist[i]);\n\t\tif(NULL == (*argv)[i])\n\t\t{\n\t\t\tfprintf(stderr, \"\\nFATAL: utf16_to_utf8 failed\\n\\n\");\n\t\t\texit(-1);\n\t\t}\n\t}\n\n\tLocalFree(szArglist);\n}\n\nvoid lsx_free_commandline_arguments(int *argc, char ***argv)\n{\n\tint i = 0;\n\t\n\tif(*argv != NULL)\n\t{\n\t\tfor(i = 0; i < *argc; i++)\n\t\t{\n\t\t\tif((*argv)[i] != NULL)\n\t\t\t{\n\t\t\t\tfree((*argv)[i]);\n\t\t\t\t(*argv)[i] = NULL;\n\t\t\t}\n\t\t}\n\t\tfree(*argv);\n\t\t*argv = NULL;\n\t}\n}\n\nFILE *lsx_fopen(const char *filename_utf8, const char *mode_utf8)\n{\n\tFILE *ret = NULL;\n\twchar_t *filename_utf16 = utf8_to_utf16(filename_utf8);\n\twchar_t *mode_utf16 = utf8_to_utf16(mode_utf8);\n\t\n\tif(filename_utf16 && mode_utf16)\n\t{\n\t\tFILE *fh = NULL;\n\t\tint err = _wfopen_s(&fh, filename_utf16, mode_utf16);\n\t\tif(err == 0) ret = fh;\n\t}\n\n\tif(filename_utf16) free(filename_utf16);\n\tif(mode_utf16) free(mode_utf16);\n\n\treturn ret;\n}\n\nint lsx_stat(const char *path_utf8, struct _stat *buf)\n{\n\tint ret = -1;\n\t\n\twchar_t *path_utf16 = utf8_to_utf16(path_utf8);\n\tif(path_utf16)\n\t{\n\t\tret = _wstat(path_utf16, buf);\n\t\tfree(path_utf16);\n\t}\n\t\n\treturn ret;\n}\n\nint lsx_unlink(const char *path_utf8)\n{\n\tint ret = -1;\n\t\n\twchar_t *path_utf16 = utf8_to_utf16(path_utf8);\n\tif(path_utf16)\n\t{\n\t\tret = _wunlink(path_utf16);\n\t\tfree(path_utf16);\n\t}\n\t\n\treturn ret;\n}\n\nvoid lsx_init_console(void)\n{\n\tg_old_output_cp = GetConsoleOutputCP();\n\tSetConsoleOutputCP(CP_UTF8);\n}\n\nvoid lsx_uninit_console(void)\n{\n\tif(g_old_output_cp != ((UINT)-1))\n\t{\n\t\tSetConsoleOutputCP(g_old_output_cp);\n\t}\n}\n\n#endif"
  },
  {
    "path": "DynamicAudioNormalizerSoX/extra/unicode_support.h",
    "content": "/* Copyright (c) 2004-2019 LoRd_MuldeR <mulder2@gmx.de>\n   File: unicode_support.h\n\n   This file was originally part of a patch included with LameXP,\n   released under the same license as the original audio tools.\n\n   Redistribution and use in source and binary forms, with or without\n   modification, are permitted provided that the following conditions\n   are met:\n\n   - Redistributions of source code must retain the above copyright\n   notice, this list of conditions and the following disclaimer.\n\n   - Redistributions in binary form must reproduce the above copyright\n   notice, this list of conditions and the following disclaimer in the\n   documentation and/or other materials provided with the distribution.\n\n   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR\n   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\n#ifndef UNICODE_SUPPORT_H_INCLUDED\n#define UNICODE_SUPPORT_H_INCLUDED\n\n#include <stdio.h>\n#include <sys/stat.h>\n\n#define WIN_UNICODE 1\n\n//char *utf16_to_utf8(const wchar_t *input);\n//char *utf16_to_ansi(const wchar_t *input);\n//wchar_t *utf8_to_utf16(const char *input);\n\nvoid lsx_init_commandline_arguments(int *argc, char ***argv);\nvoid lsx_free_commandline_arguments(int *argc, char ***argv);\nFILE *lsx_fopen(const char *filename_utf8, const char *mode_utf8);\nint lsx_stat(const char *path_utf8, struct _stat *buf);\nint lsx_unlink(const char *path_utf8);\nvoid lsx_init_console(void);\nvoid lsx_uninit_console(void);\n\n#endif"
  },
  {
    "path": "DynamicAudioNormalizerSoX/patch/SoX-v14.4.2-Patch1-UnicodeSupport+BuildFix.diff",
    "content": " src/effects_i.c       |   3 +-\n src/formats.c         |  51 ++++++-------\n src/libsox_i.c        |   7 +-\n src/noiseprof.c       |   3 +-\n src/sox.c             |  31 ++++++--\n src/unicode_support.c | 199 ++++++++++++++++++++++++++++++++++++++++++++++++++\n src/unicode_support.h |  46 ++++++++++++\n 7 files changed, 304 insertions(+), 36 deletions(-)\n\ndiff --git a/src/effects_i.c b/src/effects_i.c\nindex 685e962c..deee4443 100644\n--- a/src/effects_i.c\n+++ b/src/effects_i.c\n@@ -20,6 +20,7 @@\n \n #define LSX_EFF_ALIAS\n #include \"sox_i.h\"\n+#include \"unicode_support.h\"\n #include <string.h>\n #include <ctype.h>\n \n@@ -463,7 +464,7 @@ FILE * lsx_open_input_file(sox_effect_t * effp, char const * filename, sox_bool\n     effp->global_info->global_info->stdin_in_use_by = effp->handler.name;\n     file = stdin;\n   }\n-  else if (!(file = fopen(filename, text_mode ? \"r\" : \"rb\"))) {\n+  else if (!(file = lsx_fopen(filename, text_mode ? \"r\" : \"rb\"))) {\n     lsx_fail(\"couldn't open file %s: %s\", filename, strerror(errno));\n     return NULL;\n   }\ndiff --git a/src/formats.c b/src/formats.c\nindex 724a4cda..b6cecfff 100644\n--- a/src/formats.c\n+++ b/src/formats.c\n@@ -19,6 +19,7 @@\n  */\n \n #include \"sox_i.h\"\n+#include \"unicode_support.h\"\n \n #include <assert.h>\n #include <ctype.h>\n@@ -401,32 +402,32 @@ static FILE * xfopen(char const * identifier, char const * mode, lsx_io_type * i\n #endif\n     return f;\n   }\n-  return fopen(identifier, mode);\n+  return lsx_fopen(identifier, mode);\n }\n \n /* Hack to rewind pipes (a small amount).\n  * Works by resetting the FILE buffer pointer */\n-static void UNUSED rewind_pipe(FILE * fp)\n-{\n-/* _FSTDIO is for Torek stdio (i.e. most BSD-derived libc's)\n- * In theory, we no longer need to check _NEWLIB_VERSION or __APPLE__ */\n-#if defined _FSTDIO || defined _NEWLIB_VERSION || defined __APPLE__\n-  fp->_p -= PIPE_AUTO_DETECT_SIZE;\n-  fp->_r += PIPE_AUTO_DETECT_SIZE;\n-#elif defined __GLIBC__\n-  fp->_IO_read_ptr = fp->_IO_read_base;\n-#elif defined _MSC_VER || defined _WIN32 || defined _WIN64 || \\\n-      defined _ISO_STDIO_ISO_H || defined __sgi\n-  fp->_ptr = fp->_base;\n-#else\n-  /* To fix this #error, either simply remove the #error line and live without\n-   * file-type detection with pipes, or add support for your compiler in the\n-   * lines above.  Test with cat monkey.wav | ./sox --info - */\n-  #error FIX NEEDED HERE\n-  #define NO_REWIND_PIPE\n-  (void)fp;\n-#endif\n-}\n+//static void UNUSED rewind_pipe(FILE * fp)\n+//{\n+///* _FSTDIO is for Torek stdio (i.e. most BSD-derived libc's)\n+// * In theory, we no longer need to check _NEWLIB_VERSION or __APPLE__ */\n+//#if defined _FSTDIO || defined _NEWLIB_VERSION || defined __APPLE__\n+//  fp->_p -= PIPE_AUTO_DETECT_SIZE;\n+//  fp->_r += PIPE_AUTO_DETECT_SIZE;\n+//#elif defined __GLIBC__\n+//  fp->_IO_read_ptr = fp->_IO_read_base;\n+//#elif defined _MSC_VER || defined _WIN32 || defined _WIN64 || \\\n+//      defined _ISO_STDIO_ISO_H || defined __sgi\n+//  fp->_ptr = fp->_base;\n+//#else\n+//  /* To fix this #error, either simply remove the #error line and live without\n+//   * file-type detection with pipes, or add support for your compiler in the\n+//   * lines above.  Test with cat monkey.wav | ./sox --info - */\n+//  #error FIX NEEDED HERE\n+//  #define NO_REWIND_PIPE\n+//  (void)fp;\n+//#endif\n+//}\n \n static sox_format_t * open_read(\n     char               const * path,\n@@ -853,8 +854,8 @@ static sox_format_t * open_write(\n       ft->fp = stdout;\n     }\n     else {\n-      struct stat st;\n-      if (!stat(path, &st) && (st.st_mode & S_IFMT) == S_IFREG &&\n+      struct _stat st;\n+      if (!lsx_stat(path, &st) && (st.st_mode & S_IFMT) == S_IFREG &&\n           (overwrite_permitted && !overwrite_permitted(path))) {\n         lsx_fail(\"permission to overwrite `%s' denied\", path);\n         goto error;\n@@ -864,7 +865,7 @@ static sox_format_t * open_write(\n         buffer? fmemopen(buffer, buffer_size, \"w+b\") :\n         buffer_ptr? open_memstream(buffer_ptr, buffer_size_ptr) :\n #endif\n-        fopen(path, \"w+b\");\n+        lsx_fopen(path, \"w+b\");\n       if (ft->fp == NULL) {\n         lsx_fail(\"can't open output file `%s': %s\", path, strerror(errno));\n         goto error;\ndiff --git a/src/libsox_i.c b/src/libsox_i.c\nindex a5afb8e8..f834136f 100644\n--- a/src/libsox_i.c\n+++ b/src/libsox_i.c\n@@ -20,6 +20,7 @@\n \n \n #include \"sox_i.h\"\n+#include \"unicode_support.h\"\n \n #ifdef HAVE_IO_H\n   #include <io.h>\n@@ -48,8 +49,8 @@\n #ifdef WIN32\n static int check_dir(char * buf, size_t buflen, char const * name)\n {\n-  struct stat st;\n-  if (!name || stat(name, &st) || (st.st_mode & S_IFMT) != S_IFDIR)\n+  struct _stat st;\n+  if (!name || lsx_stat(name, &st) || (st.st_mode & S_IFMT) != S_IFDIR)\n   {\n     return 0;\n   }\n@@ -102,7 +103,7 @@ FILE * lsx_tmpfile(void)\n     fildes = mkstemp(name);\n #ifdef HAVE_UNISTD_H\n     lsx_debug(FAKE_MKSTEMP \"mkstemp, name=%s (unlinked)\", name);\n-    unlink(name);\n+    lsx_unlink(name);\n #else\n     lsx_debug(FAKE_MKSTEMP \"mkstemp, name=%s (O_TEMPORARY)\", name);\n #endif\ndiff --git a/src/noiseprof.c b/src/noiseprof.c\nindex 8fe6d4fa..fd798ca0 100644\n--- a/src/noiseprof.c\n+++ b/src/noiseprof.c\n@@ -19,6 +19,7 @@\n  */\n \n #include \"noisered.h\"\n+#include \"unicode_support.h\"\n \n #include <assert.h>\n #include <string.h>\n@@ -75,7 +76,7 @@ static int sox_noiseprof_start(sox_effect_t * effp)\n     effp->global_info->global_info->stdout_in_use_by = effp->handler.name;\n     data->output_file = stdout;\n   }\n-  else if ((data->output_file = fopen(data->output_filename, \"wb\")) == NULL) {\n+  else if ((data->output_file = lsx_fopen(data->output_filename, \"wb\")) == NULL) {\n     lsx_fail(\"Couldn't open profile file %s: %s\", data->output_filename, strerror(errno));\n     return SOX_EOF;\n   }\ndiff --git a/src/sox.c b/src/sox.c\nindex fcdac94d..ebfaf600 100644\n--- a/src/sox.c\n+++ b/src/sox.c\n@@ -24,6 +24,7 @@\n #include \"soxconfig.h\"\n #include \"sox.h\"\n #include \"util.h\"\n+#include \"unicode_support.h\"\n \n #include <ctype.h>\n #include <errno.h>\n@@ -238,10 +239,10 @@ static void cleanup(void)\n   if (file_count) {\n     if (ofile->ft) {\n       if (!success && ofile->ft->io_type == lsx_io_file) {   /* If we failed part way through */\n-        struct stat st;                  /* writing a normal file, remove it. */\n-        if (!stat(ofile->ft->filename, &st) &&\n+        struct _stat st;                  /* writing a normal file, remove it. */\n+        if (!lsx_stat(ofile->ft->filename, &st) &&\n             (st.st_mode & S_IFMT) == S_IFREG)\n-          unlink(ofile->ft->filename);\n+          lsx_unlink(ofile->ft->filename);\n       }\n       sox_close(ofile->ft); /* Assume we can unlink a file before closing it. */\n     }\n@@ -905,7 +906,7 @@ static char * * strtoargv(char * s, int * argc)\n \n static void read_user_effects(char const *filename)\n {\n-    FILE *file = fopen(filename, \"r\");\n+    FILE *file = lsx_fopen(filename, \"r\");\n     const size_t buffer_size_step = 1024;\n     size_t buffer_size = buffer_size_step;\n     char *s = lsx_malloc(buffer_size); /* buffer for one input line */\n@@ -1272,6 +1273,7 @@ static void display_status(sox_bool all_done)\n   }\n   if (all_done)\n     fputc('\\n', stderr);\n+  fflush(stderr);\n }\n \n #ifdef HAVE_TERMIOS_H\n@@ -2136,7 +2138,7 @@ static void read_comment_file(sox_comments_t * comments, char const * const file\n   int c;\n   size_t text_length = 100;\n   char * text = lsx_malloc(text_length + 1);\n-  FILE * file = fopen(filename, \"r\");\n+  FILE * file = lsx_fopen(filename, \"r\");\n \n   if (file == NULL) {\n     lsx_fail(\"Cannot open comment file `%s'\", filename);\n@@ -2848,7 +2850,7 @@ static sox_bool cmp_comment_text(char const * c1, char const * c2)\n   return c1 && c2 && !strcasecmp(c1, c2);\n }\n \n-int main(int argc, char **argv)\n+static int sox_main(int argc, char **argv)\n {\n   size_t i;\n   char mybase[6];\n@@ -3051,3 +3053,20 @@ int main(int argc, char **argv)\n \n   return 0;\n }\n+\n+int main(int argc, char **argv)\n+{\n+\tint sox_argc;\n+\tchar **sox_argv;\n+\tint exit_code;\n+\n+\tlsx_init_console();\n+\tlsx_init_commandline_arguments(&sox_argc, &sox_argv);\n+\n+\texit_code = sox_main(sox_argc, sox_argv);\n+\n+\tlsx_uninit_console();\n+\tlsx_free_commandline_arguments(&sox_argc, &sox_argv);\n+\n+\treturn exit_code;\n+}\ndiff --git a/src/unicode_support.c b/src/unicode_support.c\nnew file mode 100644\nindex 00000000..f89aa7b5\n--- /dev/null\n+++ b/src/unicode_support.c\n@@ -0,0 +1,199 @@\n+/* Copyright (c) 2004-2015 LoRd_MuldeR <mulder2@gmx.de>\n+   File: unicode_support.c\n+\n+   This file was originally part of a patch included with LameXP,\n+   released under the same license as the original audio tools.\n+\n+   Redistribution and use in source and binary forms, with or without\n+   modification, are permitted provided that the following conditions\n+   are met:\n+\n+   - Redistributions of source code must retain the above copyright\n+   notice, this list of conditions and the following disclaimer.\n+\n+   - Redistributions in binary form must reproduce the above copyright\n+   notice, this list of conditions and the following disclaimer in the\n+   documentation and/or other materials provided with the distribution.\n+\n+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR\n+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+*/\n+#if defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64\n+\n+#include \"unicode_support.h\"\n+\n+#include <windows.h>\n+#include <io.h>\n+\n+static UINT g_old_output_cp = ((UINT)-1);\n+\n+static char *utf16_to_utf8(const wchar_t *input)\n+{\n+\tchar *Buffer;\n+\tint BuffSize = 0, Result = 0;\n+\n+\tBuffSize = WideCharToMultiByte(CP_UTF8, 0, input, -1, NULL, 0, NULL, NULL);\n+\tBuffer = (char*) malloc(sizeof(char) * BuffSize);\n+\tif(Buffer)\n+\t{\n+\t\tResult = WideCharToMultiByte(CP_UTF8, 0, input, -1, Buffer, BuffSize, NULL, NULL);\n+\t}\n+\n+\treturn ((Result > 0) && (Result <= BuffSize)) ? Buffer : NULL;\n+}\n+\n+static char *utf16_to_ansi(const wchar_t *input)\n+{\n+\tchar *Buffer;\n+\tint BuffSize = 0, Result = 0;\n+\n+\tBuffSize = WideCharToMultiByte(CP_ACP, 0, input, -1, NULL, 0, NULL, NULL);\n+\tBuffer = (char*) malloc(sizeof(char) * BuffSize);\n+\tif(Buffer)\n+\t{\n+\t\tResult = WideCharToMultiByte(CP_ACP, 0, input, -1, Buffer, BuffSize, NULL, NULL);\n+\t}\n+\n+\treturn ((Result > 0) && (Result <= BuffSize)) ? Buffer : NULL;\n+}\n+\n+static wchar_t *utf8_to_utf16(const char *input)\n+{\n+\twchar_t *Buffer;\n+\tint BuffSize = 0, Result = 0;\n+\n+\tBuffSize = MultiByteToWideChar(CP_UTF8, 0, input, -1, NULL, 0);\n+\tBuffer = (wchar_t*) malloc(sizeof(wchar_t) * BuffSize);\n+\tif(Buffer)\n+\t{\n+\t\tResult = MultiByteToWideChar(CP_UTF8, 0, input, -1, Buffer, BuffSize);\n+\t}\n+\n+\treturn ((Result > 0) && (Result <= BuffSize)) ? Buffer : NULL;\n+}\n+\n+void lsx_init_commandline_arguments(int *argc, char ***argv)\n+{\n+\tint i, nArgs;\n+\tLPWSTR *szArglist;\n+\n+\tszArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);\n+\n+\tif(NULL == szArglist)\n+\t{\n+\t\tfprintf(stderr, \"\\nFATAL: CommandLineToArgvW failed\\n\\n\");\n+\t\texit(-1);\n+\t}\n+\n+\t*argv = (char**) malloc(sizeof(char*) * nArgs);\n+\t*argc = nArgs;\n+\n+\tif(NULL == *argv)\n+\t{\n+\t\tfprintf(stderr, \"\\nFATAL: Malloc failed\\n\\n\");\n+\t\texit(-1);\n+\t}\n+\t\n+\tfor(i = 0; i < nArgs; i++)\n+\t{\n+\t\t(*argv)[i] = utf16_to_utf8(szArglist[i]);\n+\t\tif(NULL == (*argv)[i])\n+\t\t{\n+\t\t\tfprintf(stderr, \"\\nFATAL: utf16_to_utf8 failed\\n\\n\");\n+\t\t\texit(-1);\n+\t\t}\n+\t}\n+\n+\tLocalFree(szArglist);\n+}\n+\n+void lsx_free_commandline_arguments(int *argc, char ***argv)\n+{\n+\tint i = 0;\n+\t\n+\tif(*argv != NULL)\n+\t{\n+\t\tfor(i = 0; i < *argc; i++)\n+\t\t{\n+\t\t\tif((*argv)[i] != NULL)\n+\t\t\t{\n+\t\t\t\tfree((*argv)[i]);\n+\t\t\t\t(*argv)[i] = NULL;\n+\t\t\t}\n+\t\t}\n+\t\tfree(*argv);\n+\t\t*argv = NULL;\n+\t}\n+}\n+\n+FILE *lsx_fopen(const char *filename_utf8, const char *mode_utf8)\n+{\n+\tFILE *ret = NULL;\n+\twchar_t *filename_utf16 = utf8_to_utf16(filename_utf8);\n+\twchar_t *mode_utf16 = utf8_to_utf16(mode_utf8);\n+\t\n+\tif(filename_utf16 && mode_utf16)\n+\t{\n+\t\tFILE *fh = NULL;\n+\t\tint err = _wfopen_s(&fh, filename_utf16, mode_utf16);\n+\t\tif(err == 0) ret = fh;\n+\t}\n+\n+\tif(filename_utf16) free(filename_utf16);\n+\tif(mode_utf16) free(mode_utf16);\n+\n+\treturn ret;\n+}\n+\n+int lsx_stat(const char *path_utf8, struct _stat *buf)\n+{\n+\tint ret = -1;\n+\t\n+\twchar_t *path_utf16 = utf8_to_utf16(path_utf8);\n+\tif(path_utf16)\n+\t{\n+\t\tret = _wstat(path_utf16, buf);\n+\t\tfree(path_utf16);\n+\t}\n+\t\n+\treturn ret;\n+}\n+\n+int lsx_unlink(const char *path_utf8)\n+{\n+\tint ret = -1;\n+\t\n+\twchar_t *path_utf16 = utf8_to_utf16(path_utf8);\n+\tif(path_utf16)\n+\t{\n+\t\tret = _wunlink(path_utf16);\n+\t\tfree(path_utf16);\n+\t}\n+\t\n+\treturn ret;\n+}\n+\n+void lsx_init_console(void)\n+{\n+\tg_old_output_cp = GetConsoleOutputCP();\n+\tSetConsoleOutputCP(CP_UTF8);\n+}\n+\n+void lsx_uninit_console(void)\n+{\n+\tif(g_old_output_cp != ((UINT)-1))\n+\t{\n+\t\tSetConsoleOutputCP(g_old_output_cp);\n+\t}\n+}\n+\n+#endif\n\\ No newline at end of file\ndiff --git a/src/unicode_support.h b/src/unicode_support.h\nnew file mode 100644\nindex 00000000..6abd0b38\n--- /dev/null\n+++ b/src/unicode_support.h\n@@ -0,0 +1,46 @@\n+/* Copyright (c) 2004-2015 LoRd_MuldeR <mulder2@gmx.de>\n+   File: unicode_support.h\n+\n+   This file was originally part of a patch included with LameXP,\n+   released under the same license as the original audio tools.\n+\n+   Redistribution and use in source and binary forms, with or without\n+   modification, are permitted provided that the following conditions\n+   are met:\n+\n+   - Redistributions of source code must retain the above copyright\n+   notice, this list of conditions and the following disclaimer.\n+\n+   - Redistributions in binary form must reproduce the above copyright\n+   notice, this list of conditions and the following disclaimer in the\n+   documentation and/or other materials provided with the distribution.\n+\n+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR\n+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+*/\n+#ifndef UNICODE_SUPPORT_H_INCLUDED\n+#define UNICODE_SUPPORT_H_INCLUDED\n+\n+#include <stdio.h>\n+#include <sys/stat.h>\n+\n+#define WIN_UNICODE 1\n+\n+void lsx_init_commandline_arguments(int *argc, char ***argv);\n+void lsx_free_commandline_arguments(int *argc, char ***argv);\n+FILE *lsx_fopen(const char *filename_utf8, const char *mode_utf8);\n+int lsx_stat(const char *path_utf8, struct _stat *buf);\n+int lsx_unlink(const char *path_utf8);\n+void lsx_init_console(void);\n+void lsx_uninit_console(void);\n+\n+#endif\n\\ No newline at end of file\n"
  },
  {
    "path": "DynamicAudioNormalizerSoX/patch/SoX-v14.4.2-Patch2-AddDynAudNormEffect.diff",
    "content": " src/DynamicAudioNormalizerSoX.c | 479 ++++++++++++++++++++++++++++++++++++++++\n src/effects.h                   |   1 +\n 2 files changed, 480 insertions(+)\n\ndiff --git a/src/DynamicAudioNormalizerSoX.c b/src/DynamicAudioNormalizerSoX.c\nnew file mode 100644\nindex 00000000..4c0bc728\n--- /dev/null\n+++ b/src/DynamicAudioNormalizerSoX.c\n@@ -0,0 +1,479 @@\n+/* ================================================================================== */\n+/* Dynamic Audio Normalizer - SoX Effect Wrapper                                      */\n+/* Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.        */\n+/*                                                                                    */\n+/* Permission is hereby granted, free of charge, to any person obtaining a copy       */\n+/* of this software and associated documentation files (the \"Software\"), to deal      */\n+/* in the Software without restriction, including without limitation the rights       */\n+/* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell          */\n+/* copies of the Software, and to permit persons to whom the Software is              */\n+/* furnished to do so, subject to the following conditions:                           */\n+/*                                                                                    */\n+/* The above copyright notice and this permission notice shall be included in         */\n+/* all copies or substantial portions of the Software.                                */\n+/*                                                                                    */\n+/* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR         */\n+/* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,           */\n+/* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE        */\n+/* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER             */\n+/* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,      */\n+/* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN          */\n+/* THE SOFTWARE.                                                                      */\n+/*                                                                                    */\n+/* http://opensource.org/licenses/MIT                                                 */\n+/* ================================================================================== */\n+\n+/*Shut up warnings*/\n+#define _CRT_SECURE_NO_WARNINGS\n+\n+/*printf() macros*/\n+#ifndef __STDC_FORMAT_MACROS\n+#define __STDC_FORMAT_MACROS 1\n+#endif\n+\n+/*SoX internal stuff*/\n+#include \"sox_i.h\"\n+\n+/*Win32 Unicode support*/\n+#ifdef _WIN32\n+#include \"unicode_support.h\"\n+#else\n+#define lsx_fopen(X,Y) fopen((X),(Y))\n+#endif /*_WIN32*/\n+\n+/*StdLib*/\n+#include <string.h>\n+#include <stdarg.h>\n+#include <ctype.h>\n+#include <inttypes.h>\n+\n+/*Linkage*/\n+#if defined(_MSC_VER) && defined(_MT)\n+#define MDYNAMICAUDIONORMALIZER_STATIC\n+static const char *LINKAGE = \"Static\";\n+#else\n+static const char *LINKAGE = \"Shared\";\n+#endif\n+\n+/*Dynamic Audio Normalizer*/\n+#include <DynamicAudioNormalizer.h>\n+\n+/* ================================================================================== */\n+/* Private Data                                                                       */\n+/* ================================================================================== */\n+\n+typedef struct\n+{\n+\tuint32_t frameLenMsec;\n+\tuint32_t filterSize;\n+\tdouble peakValue;\n+\tdouble maxAmplification;\n+\tdouble targetRms;\n+\tdouble compressFactor;\n+\tint channelsCoupled;\n+\tint enableDCCorrection;\n+\tint altBoundaryMode;\n+\tFILE *logFile;\n+}\n+settings_t;\n+\n+typedef struct\n+{\n+\tsettings_t settings;\n+\tMDynamicAudioNormalizer_Handle *instance;\n+\tdouble **temp;\n+\tsize_t tempSize;\n+}\n+priv_t;\n+\n+/* ================================================================================== */\n+/* Internal Functions                                                                 */\n+/* ================================================================================== */\n+\n+static int parseArgInt(const char *const str, uint32_t *parameter, const uint32_t min_val, const uint32_t max_val)\n+{\n+\tuint32_t temp;\n+\tif(sscanf(str, \"%u\", &temp) == 1)\n+\t{\n+\t\t*parameter = max(min_val, min(max_val, temp));\n+\t\treturn 1;\n+\t}\n+\tlsx_fail(\"Failed to parse integral value `%s'\", str);\n+\treturn 0;\n+}\n+\n+static int parseArgDbl(const char *const str, double *parameter, const double min_val, const double max_val)\n+{\n+\tdouble temp;\n+\tif(sscanf(str, \"%lf\", &temp) == 1)\n+\t{\n+\t\t*parameter = max(min_val, min(max_val, temp));\n+\t\treturn 1;\n+\t}\n+\tlsx_fail(\"Failed to parse floating point value `%s'\", str);\n+\treturn 0;\n+}\n+\n+#define TRY_PARSE(TYPE, PARAM, MIN, MAX) do \\\n+{ \\\n+\tif(!parseArg##TYPE(optstate.arg, &(PARAM), (MIN), (MAX))) \\\n+\t{ \\\n+\t\treturn 0; \\\n+\t} \\\n+} \\\n+while(0)\n+\n+static void dynaudnorm_defaults(settings_t *settings)\n+{\n+\tmemset(settings, 0, sizeof(settings_t));\n+\n+\tsettings->frameLenMsec       = 500;\n+\tsettings->filterSize         =  31;\n+\tsettings->peakValue          =   0.95;\n+\tsettings->maxAmplification   =  10.0;\n+\tsettings->targetRms          =   0.0;\n+\tsettings->compressFactor     =   0.0;\n+\tsettings->channelsCoupled    =   1;\n+\tsettings->enableDCCorrection =   0;\n+\tsettings->altBoundaryMode    =   0;\n+}\n+\n+static int dynaudnorm_parse_args(settings_t *settings, int argc, char **argv)\n+{\n+\tstatic const char *const opts = \"+f:g:p:m:r:ncbs:l:\";\n+\tlsx_getopt_t optstate; char c;\n+\tlsx_getopt_init(argc, argv, opts, NULL, lsx_getopt_flag_opterr, 1, &optstate);\n+\n+\twhile((c = lsx_getopt(&optstate)) != -1)\n+\t{\n+\t\tswitch(tolower(c))\n+\t\t{\n+\t\tcase 'f':\n+\t\t\tTRY_PARSE(Int, settings->frameLenMsec, 10, 8000);\n+\t\t\tbreak;\n+\t\tcase 'g':\n+\t\t\tTRY_PARSE(Int, settings->filterSize, 3, 301);\n+\t\t\tsettings->filterSize += ((settings->filterSize + 1) % 2);\n+\t\t\tbreak;\n+\t\tcase 'p':\n+\t\t\tTRY_PARSE(Dbl, settings->peakValue, 0.0, 1.0);\n+\t\t\tbreak;\n+\t\tcase 'm':\n+\t\t\tTRY_PARSE(Dbl, settings->maxAmplification, 1.0, 100.0);\n+\t\t\tbreak;\n+\t\tcase 'r':\n+\t\t\tTRY_PARSE(Dbl, settings->targetRms, 0.0, 1.0);\n+\t\t\tbreak;\n+\t\tcase 'n':\n+\t\t\tsettings->channelsCoupled = 0;\n+\t\t\tbreak;\n+\t\tcase 'c':\n+\t\t\tsettings->enableDCCorrection = 1;\n+\t\t\tbreak;\n+\t\tcase 'b':\n+\t\t\tsettings->altBoundaryMode = 1;\n+\t\t\tbreak;\n+\t\tcase 's':\n+\t\t\tTRY_PARSE(Dbl, settings->compressFactor, 0.0, 30.0);\n+\t\t\tbreak;\n+\t\tcase 'l':\n+\t\t\tif(!settings->logFile)\n+\t\t\t{\n+\t\t\t\tsettings->logFile = lsx_fopen(optstate.arg, \"w\");\n+\t\t\t\tif(!settings->logFile)\n+\t\t\t\t{\n+\t\t\t\t\tlsx_warn(\"Failed to open logfile `%s'\", optstate.arg);\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\treturn 0;\n+\t\t}\n+\t}\n+\n+\treturn 1;\n+}\n+\n+static void dynaudnorm_deinterleave(double **temp, const sox_sample_t *const in, const size_t samples_per_channel, const unsigned channels)\n+{\n+\tsize_t i, c, in_pos = 0;\n+\n+\tfor(i = 0; i < samples_per_channel; i++)\n+\t{\n+\t\tfor(c = 0; c < channels; c++)\n+\t\t{\n+\t\t\ttemp[c][i] = ((double)in[in_pos++]) / ((double)SOX_INT32_MAX);\n+\t\t}\n+\t}\n+}\n+\n+static void dynaudnorm_interleave(sox_sample_t *const out, const double *const *const temp, const size_t samples_per_channel, const unsigned channels)\n+{\n+\tsize_t i, c, out_pos = 0;\n+\n+\tfor(i = 0; i < samples_per_channel; i++)\n+\t{\n+\t\tfor(c = 0; c < channels; c++)\n+\t\t{\n+\t\t\tout[out_pos++] = (sox_sample_t) round(min(1.0, max(-1.0, temp[c][i])) * ((double)SOX_INT32_MAX));\n+\t\t}\n+\t}\n+}\n+\n+static void dynaudnorm_print(sox_effect_t *effp, const char *const fmt, ...)\n+{\n+\tif(effp->global_info->global_info->output_message_handler)\n+\t{\n+\t\tva_list arg_list;\n+\t\tva_start(arg_list, fmt);\n+\t\tvfprintf(stderr, fmt, arg_list);\n+\t\tva_end(arg_list);\n+\t}\n+}\n+\n+static void dynaudnorm_log(const int logLevel, const char *const message)\n+{\n+\tswitch(logLevel)\n+\t{\n+\tcase 0:\n+\t\tlsx_report(\"%s\", message);\n+\t\tbreak;\n+\tcase 1:\n+\t\tlsx_warn(\"%s\", message);\n+\t\tbreak;\n+\tcase 2:\n+\t\tlsx_fail(\"%s\", message);\n+\t\tbreak;\n+\t}\n+}\n+\n+static void dynaudnorm_update_buffsize(const sox_effect_t *const effp, priv_t *const p, const size_t input_samples)\n+{\n+\tsize_t c;\n+\tif(input_samples > p->tempSize)\n+\t{\n+\t\tlsx_warn(\"Increasing buffer size: %\" PRIu64 \" -> %\" PRIu64, (uint64_t)p->tempSize, (uint64_t)input_samples);\n+\t\tfor(c = 0; c < effp->in_signal.channels; c++)\n+\t\t{\n+\t\t\tp->temp[c] = lsx_realloc(p->temp[c], input_samples * sizeof(double));\n+\t\t}\n+\t\tp->tempSize = input_samples;\n+\t}\n+}\n+\n+/* ================================================================================== */\n+/* SoX Callback Functions                                                             */\n+/* ================================================================================== */\n+\n+static int dynaudnorm_kill(sox_effect_t *effp)\n+{\n+\tlsx_report(\"dynaudnorm_kill()\");\n+\tlsx_report(\"flows=%\" PRIu64 \", flow=%\" PRIu64 , (uint64_t)effp->flows, (uint64_t)effp->flow);\n+\treturn SOX_SUCCESS;\n+}\n+\n+static int dynaudnorm_create(sox_effect_t *effp, int argc, char **argv)\n+{\n+\tpriv_t *const p = (priv_t *)effp->priv;\n+\n+\tlsx_report(\"dynaudnorm_create()\");\n+\tlsx_report(\"flows=%\" PRIu64 \", flow=%\" PRIu64 , (uint64_t)effp->flows, (uint64_t)effp->flow);\n+\n+\tmemset(effp->priv, 0, sizeof(priv_t));\n+\tdynaudnorm_defaults(&p->settings);\n+\n+\tif(!dynaudnorm_parse_args(&p->settings, argc, argv))\n+\t{\n+\t\treturn lsx_usage(effp);\n+\t}\n+\n+\treturn SOX_SUCCESS;\n+}\n+\n+static int dynaudnorm_stop(sox_effect_t *effp)\n+{\n+\tpriv_t *const p = (priv_t *)effp->priv;\n+\tsize_t c;\n+\n+\tlsx_report(\"dynaudnorm_stop()\");\n+\n+\tif(p->instance)\n+\t{\n+\t\tMDYNAMICAUDIONORMALIZER_FUNCTION(destroyInstance)(&p->instance);\n+\t\tp->instance = NULL;\n+\t}\n+\n+\tif(p->settings.logFile)\n+\t{\n+\t\tfclose(p->settings.logFile);\n+\t\tp->settings.logFile = NULL;\n+\t}\n+\n+\tif(p->temp)\n+\t{\n+\t\tfor(c = 0; c < effp->in_signal.channels; c++)\n+\t\t{\n+\t\t\tfree(p->temp[c]);\n+\t\t\tp->temp[c] = NULL;\n+\t\t}\n+\t\tfree(p->temp);\n+\t\tp->temp = NULL;\n+\t}\n+\n+\treturn SOX_SUCCESS;\n+}\n+\n+static int dynaudnorm_start(sox_effect_t *effp)\n+{\n+\tpriv_t *const p = (priv_t *)effp->priv;\n+\n+\tlsx_report(\"dynaudnorm_start()\");\n+\tlsx_report(\"flows=%\" PRIu64 \", flow=%\" PRIu64 \", in_signal.rate=%.2f, in_signal.channels=%\" PRIu64, (uint64_t)effp->flows, (uint64_t)effp->flow, effp->in_signal.rate, (uint64_t)effp->in_signal.channels);\n+\n+\tif((effp->flow == 0) && (effp->global_info->global_info->verbosity > 1))\n+\t{\n+\t\tuint32_t versionMajor, versionMinor, versionPatch;\n+\t\tconst char *buildDate, *buildTime, *buildCompiler, *buildArch; int buildDebug;\n+\n+\t\tMDYNAMICAUDIONORMALIZER_FUNCTION(getVersionInfo)(&versionMajor, &versionMinor, &versionPatch);\n+\t\tMDYNAMICAUDIONORMALIZER_FUNCTION(getBuildInfo)(&buildDate, &buildTime, &buildCompiler, &buildArch, &buildDebug);\n+\n+\t\tdynaudnorm_print(effp, \"\\n---------------------------------------------------------------------------\\n\");\n+\t\tdynaudnorm_print(effp, \"Dynamic Audio Normalizer (SoX Wrapper), Version %u.%02u-%u, %s\\n\", versionMajor, versionMinor, versionPatch, LINKAGE);\n+\t\tdynaudnorm_print(effp, \"Copyright (c) 2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\\n\");\n+\t\tdynaudnorm_print(effp, \"Built on %s at %s with %s for %s.\\n\\n\", buildDate, buildTime, buildCompiler, buildArch);\n+\t\tdynaudnorm_print(effp, \"This program is free software: you can redistribute it and/or modify\\n\");\n+\t\tdynaudnorm_print(effp, \"it under the terms of the GNU General Public License <http://www.gnu.org/>.\\n\");\n+\t\tdynaudnorm_print(effp, \"Note that this program is distributed with ABSOLUTELY NO WARRANTY.\\n\");\n+\t\tdynaudnorm_print(effp, \"---------------------------------------------------------------------------\\n\\n\");\n+\t}\n+\n+\tp->tempSize = (size_t) max(ceil(effp->in_signal.rate), 8192.0); /*initial buffer size is one second*/\n+\n+\tp->instance = MDYNAMICAUDIONORMALIZER_FUNCTION(createInstance)\n+\t(\n+\t\teffp->in_signal.channels,\n+\t\t(uint32_t) round(effp->in_signal.rate),\n+\t\tp->settings.frameLenMsec,\n+\t\tp->settings.filterSize,\n+\t\tp->settings.peakValue,\n+\t\tp->settings.maxAmplification,\n+\t\tp->settings.targetRms,\n+\t\tp->settings.compressFactor,\n+\t\tp->settings.channelsCoupled,\n+\t\tp->settings.enableDCCorrection,\n+\t\tp->settings.altBoundaryMode,\n+\t\tp->settings.logFile\n+\t);\n+\n+\tif(p->instance)\n+\t{\n+\t\tsize_t c;\n+\t\tp->temp = (double**) lsx_calloc(effp->in_signal.channels, sizeof(double*));\n+\t\tfor(c = 0; c < effp->in_signal.channels; c++)\n+\t\t{\n+\t\t\tp->temp[c] = (double*) lsx_calloc(p->tempSize, sizeof(double));\n+\t\t}\n+\t}\n+\n+\treturn (p->instance) ? SOX_SUCCESS : SOX_EINVAL;\n+}\n+\n+static int dynaudnorm_flow(sox_effect_t *effp, const sox_sample_t *ibuf, sox_sample_t *obuf, size_t *isamp, size_t *osamp)\n+{\n+\tpriv_t *const p = (priv_t *)effp->priv;\n+\tconst size_t input_samples = min((*isamp), (*osamp)) / effp->in_signal.channels; /*this is per channel!*/\n+\tint64_t output_samples = 0;\n+\n+\tlsx_debug(\"dynaudnorm_flow()\");\n+\tdynaudnorm_update_buffsize(effp, p, input_samples);\n+\n+\tif(input_samples > 0)\n+\t{\n+\t\tdynaudnorm_deinterleave(p->temp, ibuf, input_samples, effp->in_signal.channels);\n+\t\tif(!MDYNAMICAUDIONORMALIZER_FUNCTION(processInplace)(p->instance, p->temp, ((int64_t) input_samples), &output_samples))\n+\t\t{\n+\t\t\treturn SOX_EOF;\n+\t\t}\n+\t\tif(output_samples > 0)\n+\t\t{\n+\t\t\tdynaudnorm_interleave(obuf, ((const double**) p->temp), ((size_t) output_samples), effp->in_signal.channels);\n+\t\t}\n+\t}\n+\n+\n+\t*isamp = (size_t)(input_samples  * effp->in_signal.channels);\n+\t*osamp = (size_t)(output_samples * effp->in_signal.channels);\n+\n+\treturn SOX_SUCCESS;\n+}\n+\n+static int dynaudnorm_drain(sox_effect_t * effp, sox_sample_t * obuf, size_t * osamp)\n+{\n+\tpriv_t *const p = (priv_t *)effp->priv;\n+\tconst size_t input_samples = (*osamp) / effp->in_signal.channels; /*this is per channel!*/\n+\tint64_t output_samples = 0;\n+\n+\tlsx_debug(\"dynaudnorm_drain()\");\n+\tdynaudnorm_update_buffsize(effp, p, input_samples);\n+\n+\tif(input_samples > 0)\n+\t{\n+\t\tif(!MDYNAMICAUDIONORMALIZER_FUNCTION(flushBuffer)(p->instance, p->temp, ((int64_t) input_samples), &output_samples))\n+\t\t{\n+\t\t\treturn SOX_EOF;\n+\t\t}\n+\t\tif(output_samples > 0)\n+\t\t{\n+\t\t\tdynaudnorm_interleave(obuf, ((const double**) p->temp), ((size_t) output_samples), effp->in_signal.channels);\n+\t\t}\n+\t}\n+\telse\n+\t{\n+\t\tlsx_warn(\"drain() was called with zero-size output buffer!\");\n+\t}\n+\n+\t*osamp = (size_t)(output_samples * effp->in_signal.channels);\n+\treturn SOX_SUCCESS;\n+}\n+\n+/* ================================================================================== */\n+/* SoX Public API                                                                     */\n+/* ================================================================================== */\n+\n+sox_effect_handler_t const * lsx_dynaudnorm_effect_fn(void)\n+{\n+\tstatic sox_effect_handler_t handler =\n+\t{\n+\t\t\"dynaudnorm\", NULL, SOX_EFF_MCHAN,\n+\t\tdynaudnorm_create, dynaudnorm_start, dynaudnorm_flow, dynaudnorm_drain, dynaudnorm_stop, dynaudnorm_kill, sizeof(priv_t)\n+\t};\n+\n+\tstatic char const * lines[] =\n+\t{\n+\t\t\"[options]\",\n+\t\t\"\",\n+\t\t\"Algorithm Tweaks:\",\n+\t\t\"  -f <value>  Frame length, in milliseconds\",\n+\t\t\"  -g <value>  Gauss filter size, in frames\",\n+\t\t\"  -p <value>  Target peak magnitude, 0.1-1.0\",\n+\t\t\"  -m <value>  Maximum gain factor\",\n+\t\t\"  -r <value>  Target RMS value\",\n+\t\t\"  -n          Disable channel coupling\",\n+\t\t\"  -c          Enable the DC bias correction\",\n+\t\t\"  -b          Use alternative boundary mode\",\n+\t\t\"  -s <value>  Compress the input data\",\n+\t\t\"\",\n+\t\t\"Diagnostics:\",\n+\t\t\"  -l <file>   Create a log file\",\n+\t\t\"\",\n+\t\t\"\",\n+\t\t\"Please refer to the manual for a detailed explanation!\"\n+\t};\n+\t\n+\tstatic char *usage;\n+\thandler.usage = lsx_usage_lines(&usage, lines, array_length(lines));\n+\n+\tMDYNAMICAUDIONORMALIZER_FUNCTION(setLogFunction)(dynaudnorm_log);\n+\treturn &handler;\n+}\ndiff --git a/src/effects.h b/src/effects.h\nindex 450a5c2c..773b63bd 100644\n--- a/src/effects.h\n+++ b/src/effects.h\n@@ -33,6 +33,7 @@\n   EFFECT(dither)\n   EFFECT(divide)\n   EFFECT(downsample)\n+  EFFECT(dynaudnorm)\n   EFFECT(earwax)\n   EFFECT(echo)\n   EFFECT(echos)\n"
  },
  {
    "path": "DynamicAudioNormalizerVST/DynamicAudioNormalizerVST.def",
    "content": "EXPORTS\n\tVSTPluginMain\n\tmain=VSTPluginMain"
  },
  {
    "path": "DynamicAudioNormalizerVST/DynamicAudioNormalizerVST_VS2013.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"12.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"Debug|Win32\">\n      <Configuration>Debug</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Debug|x64\">\n      <Configuration>Debug</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|Win32\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|x64\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|Win32\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|x64\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\audioeffect.cpp\" />\n    <ClCompile Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\audioeffectx.cpp\" />\n    <ClCompile Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\vstplugmain.cpp\" />\n    <ClCompile Include=\"src\\DynamicAudioNormalizerVST.cpp\" />\n    <ClCompile Include=\"src\\Spooky.cpp\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\aeffeditor.h\" />\n    <ClInclude Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\audioeffect.h\" />\n    <ClInclude Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\audioeffectx.h\" />\n    <ClInclude Include=\"src\\DynamicAudioNormalizerVST.h\" />\n    <ClInclude Include=\"src\\Spooky.h\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\DynamicAudioNormalizerAPI\\DynamicAudioNormalizerAPI_VS2013.vcxproj\">\n      <Project>{376386ee-8268-47e3-a335-7663716e4c60}</Project>\n      <Private>true</Private>\n      <ReferenceOutputAssembly>true</ReferenceOutputAssembly>\n      <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>\n      <LinkLibraryDependencies>true</LinkLibraryDependencies>\n      <UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>\n    </ProjectReference>\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <ProjectGuid>{A30375E8-AEF7-4531-B372-02328E0B9D43}</ProjectGuid>\n    <Keyword>Win32Proj</Keyword>\n    <RootNamespace>DynamicAudioNormalizerVST</RootNamespace>\n    <ProjectName>DynamicAudioNormalizerVST</ProjectName>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <LinkIncremental>true</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <LinkIncremental>true</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <ClCompile>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERVST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\etc\\vst_sdk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n      <EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <ModuleDefinitionFile>$(ProjectDir)\\DynamicAudioNormalizerVST.def</ModuleDefinitionFile>\n      <AdditionalDependencies>Psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <ClCompile>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERVST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\etc\\vst_sdk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <ModuleDefinitionFile>$(ProjectDir)\\DynamicAudioNormalizerVST.def</ModuleDefinitionFile>\n      <AdditionalDependencies>Psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERVST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <RuntimeLibrary Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">MultiThreaded</RuntimeLibrary>\n      <RuntimeLibrary Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">MultiThreaded</RuntimeLibrary>\n      <RuntimeLibrary Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">MultiThreadedDebugDLL</RuntimeLibrary>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\etc\\vst_sdk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <ModuleDefinitionFile>$(ProjectDir)\\DynamicAudioNormalizerVST.def</ModuleDefinitionFile>\n      <AdditionalDependencies>Psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERVST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <RuntimeLibrary Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">MultiThreaded</RuntimeLibrary>\n      <RuntimeLibrary Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">MultiThreaded</RuntimeLibrary>\n      <RuntimeLibrary Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">MultiThreadedDebugDLL</RuntimeLibrary>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\etc\\vst_sdk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <ModuleDefinitionFile>$(ProjectDir)\\DynamicAudioNormalizerVST.def</ModuleDefinitionFile>\n      <AdditionalDependencies>Psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_STATIC;DYNAMICAUDIONORMALIZERVST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\etc\\vst_sdk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <ModuleDefinitionFile>$(ProjectDir)\\DynamicAudioNormalizerVST.def</ModuleDefinitionFile>\n      <AdditionalDependencies>Psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_STATIC;DYNAMICAUDIONORMALIZERVST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\etc\\vst_sdk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <ModuleDefinitionFile>$(ProjectDir)\\DynamicAudioNormalizerVST.def</ModuleDefinitionFile>\n      <AdditionalDependencies>Psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerVST/DynamicAudioNormalizerVST_VS2013.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n    <Filter Include=\"Source Files\\VST 2.x SDK\">\n      <UniqueIdentifier>{16f87057-2e94-42db-82e2-14293070dd05}</UniqueIdentifier>\n    </Filter>\n    <Filter Include=\"Header Files\\VST 2.x SDK\">\n      <UniqueIdentifier>{3ef921b0-70be-490e-8a3f-696f0a68e420}</UniqueIdentifier>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\audioeffect.cpp\">\n      <Filter>Source Files\\VST 2.x SDK</Filter>\n    </ClCompile>\n    <ClCompile Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\audioeffectx.cpp\">\n      <Filter>Source Files\\VST 2.x SDK</Filter>\n    </ClCompile>\n    <ClCompile Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\vstplugmain.cpp\">\n      <Filter>Source Files\\VST 2.x SDK</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\DynamicAudioNormalizerVST.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\Spooky.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\aeffeditor.h\">\n      <Filter>Header Files\\VST 2.x SDK</Filter>\n    </ClInclude>\n    <ClInclude Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\audioeffect.h\">\n      <Filter>Header Files\\VST 2.x SDK</Filter>\n    </ClInclude>\n    <ClInclude Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\audioeffectx.h\">\n      <Filter>Header Files\\VST 2.x SDK</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\DynamicAudioNormalizerVST.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\Spooky.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerVST/DynamicAudioNormalizerVST_VS2015.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"14.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"Debug|Win32\">\n      <Configuration>Debug</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Debug|x64\">\n      <Configuration>Debug</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|Win32\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|x64\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|Win32\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|x64\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\audioeffect.cpp\" />\n    <ClCompile Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\audioeffectx.cpp\" />\n    <ClCompile Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\vstplugmain.cpp\" />\n    <ClCompile Include=\"src\\DynamicAudioNormalizerVST.cpp\" />\n    <ClCompile Include=\"src\\Spooky.cpp\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\aeffeditor.h\" />\n    <ClInclude Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\audioeffect.h\" />\n    <ClInclude Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\audioeffectx.h\" />\n    <ClInclude Include=\"src\\DynamicAudioNormalizerVST.h\" />\n    <ClInclude Include=\"src\\Spooky.h\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\DynamicAudioNormalizerAPI\\DynamicAudioNormalizerAPI_VS2015.vcxproj\">\n      <Project>{376386ee-8268-47e3-a335-7663716e4c60}</Project>\n      <Private>true</Private>\n      <ReferenceOutputAssembly>true</ReferenceOutputAssembly>\n      <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>\n      <LinkLibraryDependencies>true</LinkLibraryDependencies>\n      <UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>\n    </ProjectReference>\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <ProjectGuid>{A30375E8-AEF7-4531-B372-02328E0B9D43}</ProjectGuid>\n    <Keyword>Win32Proj</Keyword>\n    <RootNamespace>DynamicAudioNormalizerVST</RootNamespace>\n    <ProjectName>DynamicAudioNormalizerVST</ProjectName>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <LinkIncremental>true</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <LinkIncremental>true</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <ClCompile>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERVST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\etc\\vst_sdk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n      <EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <ModuleDefinitionFile>$(ProjectDir)\\DynamicAudioNormalizerVST.def</ModuleDefinitionFile>\n      <AdditionalDependencies>Psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <ClCompile>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERVST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\etc\\vst_sdk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <ModuleDefinitionFile>$(ProjectDir)\\DynamicAudioNormalizerVST.def</ModuleDefinitionFile>\n      <AdditionalDependencies>Psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERVST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <RuntimeLibrary Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">MultiThreaded</RuntimeLibrary>\n      <RuntimeLibrary Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">MultiThreaded</RuntimeLibrary>\n      <RuntimeLibrary Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">MultiThreadedDebugDLL</RuntimeLibrary>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\etc\\vst_sdk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <ModuleDefinitionFile>$(ProjectDir)\\DynamicAudioNormalizerVST.def</ModuleDefinitionFile>\n      <AdditionalDependencies>Psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERVST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <RuntimeLibrary Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">MultiThreaded</RuntimeLibrary>\n      <RuntimeLibrary Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">MultiThreaded</RuntimeLibrary>\n      <RuntimeLibrary Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">MultiThreadedDebugDLL</RuntimeLibrary>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\etc\\vst_sdk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <ModuleDefinitionFile>$(ProjectDir)\\DynamicAudioNormalizerVST.def</ModuleDefinitionFile>\n      <AdditionalDependencies>Psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_STATIC;DYNAMICAUDIONORMALIZERVST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\etc\\vst_sdk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <ModuleDefinitionFile>$(ProjectDir)\\DynamicAudioNormalizerVST.def</ModuleDefinitionFile>\n      <AdditionalDependencies>Psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_STATIC;DYNAMICAUDIONORMALIZERVST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\etc\\vst_sdk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <ModuleDefinitionFile>$(ProjectDir)\\DynamicAudioNormalizerVST.def</ModuleDefinitionFile>\n      <AdditionalDependencies>Psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerVST/DynamicAudioNormalizerVST_VS2015.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n    <Filter Include=\"Source Files\\VST 2.x SDK\">\n      <UniqueIdentifier>{16f87057-2e94-42db-82e2-14293070dd05}</UniqueIdentifier>\n    </Filter>\n    <Filter Include=\"Header Files\\VST 2.x SDK\">\n      <UniqueIdentifier>{3ef921b0-70be-490e-8a3f-696f0a68e420}</UniqueIdentifier>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\audioeffect.cpp\">\n      <Filter>Source Files\\VST 2.x SDK</Filter>\n    </ClCompile>\n    <ClCompile Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\audioeffectx.cpp\">\n      <Filter>Source Files\\VST 2.x SDK</Filter>\n    </ClCompile>\n    <ClCompile Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\vstplugmain.cpp\">\n      <Filter>Source Files\\VST 2.x SDK</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\DynamicAudioNormalizerVST.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\Spooky.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\aeffeditor.h\">\n      <Filter>Header Files\\VST 2.x SDK</Filter>\n    </ClInclude>\n    <ClInclude Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\audioeffect.h\">\n      <Filter>Header Files\\VST 2.x SDK</Filter>\n    </ClInclude>\n    <ClInclude Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\audioeffectx.h\">\n      <Filter>Header Files\\VST 2.x SDK</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\DynamicAudioNormalizerVST.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\Spooky.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerVST/DynamicAudioNormalizerVST_VS2017.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"14.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"Debug|Win32\">\n      <Configuration>Debug</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Debug|x64\">\n      <Configuration>Debug</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|Win32\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|x64\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|Win32\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|x64\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>x64</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\audioeffect.cpp\" />\n    <ClCompile Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\audioeffectx.cpp\" />\n    <ClCompile Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\vstplugmain.cpp\" />\n    <ClCompile Include=\"src\\DynamicAudioNormalizerVST.cpp\" />\n    <ClCompile Include=\"src\\Spooky.cpp\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\aeffeditor.h\" />\n    <ClInclude Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\audioeffect.h\" />\n    <ClInclude Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\audioeffectx.h\" />\n    <ClInclude Include=\"src\\DynamicAudioNormalizerVST.h\" />\n    <ClInclude Include=\"src\\Spooky.h\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\DynamicAudioNormalizerAPI\\DynamicAudioNormalizerAPI_VS2017.vcxproj\">\n      <Project>{376386ee-8268-47e3-a335-7663716e4c60}</Project>\n      <Private>true</Private>\n      <ReferenceOutputAssembly>true</ReferenceOutputAssembly>\n      <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>\n      <LinkLibraryDependencies>true</LinkLibraryDependencies>\n      <UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>\n    </ProjectReference>\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"res\\DynamicAudioNormalizerVST.rc\" />\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <ProjectGuid>{A30375E8-AEF7-4531-B372-02328E0B9D43}</ProjectGuid>\n    <Keyword>Win32Proj</Keyword>\n    <RootNamespace>DynamicAudioNormalizerVST</RootNamespace>\n    <ProjectName>DynamicAudioNormalizerVST</ProjectName>\n    <WindowsTargetPlatformVersion>7.0</WindowsTargetPlatformVersion>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <LinkIncremental>true</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <LinkIncremental>true</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <ClCompile>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERVST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\etc\\vst_sdk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n      <EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <ModuleDefinitionFile>$(ProjectDir)\\DynamicAudioNormalizerVST.def</ModuleDefinitionFile>\n      <AdditionalDependencies>Psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\n    <ClCompile>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERVST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\etc\\vst_sdk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <ModuleDefinitionFile>$(ProjectDir)\\DynamicAudioNormalizerVST.def</ModuleDefinitionFile>\n      <AdditionalDependencies>Psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERVST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <RuntimeLibrary Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">MultiThreaded</RuntimeLibrary>\n      <RuntimeLibrary Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">MultiThreaded</RuntimeLibrary>\n      <RuntimeLibrary Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">MultiThreadedDebugDLL</RuntimeLibrary>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\etc\\vst_sdk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <ModuleDefinitionFile>$(ProjectDir)\\DynamicAudioNormalizerVST.def</ModuleDefinitionFile>\n      <AdditionalDependencies>Psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n    <Manifest>\n      <AdditionalManifestFiles>$(SolutionDir)DynamicAudioNormalizerShared\\res\\compat.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>\n    </Manifest>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERVST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <RuntimeLibrary Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">MultiThreaded</RuntimeLibrary>\n      <RuntimeLibrary Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">MultiThreaded</RuntimeLibrary>\n      <RuntimeLibrary Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">MultiThreadedDebugDLL</RuntimeLibrary>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\etc\\vst_sdk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <ModuleDefinitionFile>$(ProjectDir)\\DynamicAudioNormalizerVST.def</ModuleDefinitionFile>\n      <AdditionalDependencies>Psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n    <Manifest>\n      <AdditionalManifestFiles>$(SolutionDir)DynamicAudioNormalizerShared\\res\\compat.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>\n    </Manifest>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_STATIC;DYNAMICAUDIONORMALIZERVST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\etc\\vst_sdk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <ModuleDefinitionFile>$(ProjectDir)\\DynamicAudioNormalizerVST.def</ModuleDefinitionFile>\n      <AdditionalDependencies>Psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n    <Manifest>\n      <AdditionalManifestFiles>$(SolutionDir)DynamicAudioNormalizerShared\\res\\compat.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>\n    </Manifest>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|x64'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;MDYNAMICAUDIONORMALIZER_STATIC;DYNAMICAUDIONORMALIZERVST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\etc\\vst_sdk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <ModuleDefinitionFile>$(ProjectDir)\\DynamicAudioNormalizerVST.def</ModuleDefinitionFile>\n      <AdditionalDependencies>Psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n    <Manifest>\n      <AdditionalManifestFiles>$(SolutionDir)DynamicAudioNormalizerShared\\res\\compat.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>\n    </Manifest>\n  </ItemDefinitionGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerVST/DynamicAudioNormalizerVST_VS2017.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n    <Filter Include=\"Source Files\\VST 2.x SDK\">\n      <UniqueIdentifier>{16f87057-2e94-42db-82e2-14293070dd05}</UniqueIdentifier>\n    </Filter>\n    <Filter Include=\"Header Files\\VST 2.x SDK\">\n      <UniqueIdentifier>{3ef921b0-70be-490e-8a3f-696f0a68e420}</UniqueIdentifier>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\audioeffect.cpp\">\n      <Filter>Source Files\\VST 2.x SDK</Filter>\n    </ClCompile>\n    <ClCompile Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\audioeffectx.cpp\">\n      <Filter>Source Files\\VST 2.x SDK</Filter>\n    </ClCompile>\n    <ClCompile Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\vstplugmain.cpp\">\n      <Filter>Source Files\\VST 2.x SDK</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\DynamicAudioNormalizerVST.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"src\\Spooky.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\aeffeditor.h\">\n      <Filter>Header Files\\VST 2.x SDK</Filter>\n    </ClInclude>\n    <ClInclude Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\audioeffect.h\">\n      <Filter>Header Files\\VST 2.x SDK</Filter>\n    </ClInclude>\n    <ClInclude Include=\"..\\etc\\vst_sdk\\public.sdk\\source\\vst2.x\\audioeffectx.h\">\n      <Filter>Header Files\\VST 2.x SDK</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\DynamicAudioNormalizerVST.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"src\\Spooky.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"res\\DynamicAudioNormalizerVST.rc\">\n      <Filter>Resource Files</Filter>\n    </ResourceCompile>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerVST/res/DynamicAudioNormalizerVST.rc",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Library\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This library is free software; you can redistribute it and/or\n// modify it under the terms of the GNU Lesser General Public\n// License as published by the Free Software Foundation; either\n// version 2.1 of the License, or (at your option) any later version.\n//\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public\n// License along with this library; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n//\n// http://www.gnu.org/licenses/lgpl-2.1.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#include \"WinResrc.h\" //\"afxres.h\"\n\n#define INC_DYNAUDNORM_VERSION_INTERNAL 0x22b4f8a9\n#include \"../DynamicAudioNormalizerShared/res/version.inc\"\n\n//////////////////////////////////////////////////////////////////////////////////\n// Neutral resources\n//////////////////////////////////////////////////////////////////////////////////\n\n#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)\n#ifdef _WIN32\nLANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL\n#pragma code_page(1252)\n#endif //_WIN32\n\n//////////////////////////////////////////////////////////////////////////////////\n// Version\n//////////////////////////////////////////////////////////////////////////////////\n\nVS_VERSION_INFO VERSIONINFO\n FILEVERSION    VER_DYNAUDNORM_MAJOR,VER_DYNAUDNORM_MINOR_HI,VER_DYNAUDNORM_MINOR_LO,VER_DYNAUDNORM_PATCH\n PRODUCTVERSION VER_DYNAUDNORM_MAJOR,VER_DYNAUDNORM_MINOR_HI,VER_DYNAUDNORM_MINOR_LO,VER_DYNAUDNORM_PATCH\n FILEFLAGSMASK 0x17L\n#ifdef _DEBUG\n FILEFLAGS 0x3L\n#else\n FILEFLAGS 0x2L\n#endif\n FILEOS 0x40004L\n FILETYPE 0x2L\n FILESUBTYPE 0x0L\nBEGIN\n    BLOCK \"StringFileInfo\"\n    BEGIN\n        BLOCK \"000004b0\"\n        BEGIN\n            VALUE \"Comments\", \"This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License <http://www.gnu.org/>.\"\n            VALUE \"CompanyName\", \"LoRd_MuldeR <mulder2@gmx.de>\"\n            VALUE \"FileDescription\", \"DynamicAudioNormalizer VST Plugin\"\n            VALUE \"FileVersion\", VER_DYNAUDNORM_STR\n            VALUE \"InternalName\", \"DynamicAudioNormalizerVST\"\n            VALUE \"LegalCopyright\", \"Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>\"\n            VALUE \"LegalTrademarks\", \"This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License <http://www.gnu.org/>\"\n            VALUE \"OriginalFilename\", \"DynamicAudioNormalizerVST.dll\"\n            VALUE \"ProductName\", \"DynamicAudioNormalizer\"\n            VALUE \"ProductVersion\", VER_DYNAUDNORM_STR\n        END\n    END\n    BLOCK \"VarFileInfo\"\n    BEGIN\n        VALUE \"Translation\", 0x0, 1200\n    END\nEND\n\n#endif    // Neutral resources\n"
  },
  {
    "path": "DynamicAudioNormalizerVST/src/DynamicAudioNormalizerVST.cpp",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - VST 2.x Wrapper\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n// http://opensource.org/licenses/MIT\n//////////////////////////////////////////////////////////////////////////////////\n\n//////////////////////////////////////////////////////////////////////////////////\n// ACKNOWLEDGEMENT:\n// (1) VST PlugIn Interface Technology by Steinberg Media Technologies GmbH.\n// (2) VST is a trademark of Steinberg Media Technologies GmbH.\n//////////////////////////////////////////////////////////////////////////////////\n\n#include \"DynamicAudioNormalizerVST.h\"\n\n//Dynamic Audio Normalizer API\n#include <DynamicAudioNormalizer.h>\n\n//Internal\n#include <Common.h>\n#include <Threads.h>\n#include \"Spooky.h\"\n\n//Standard Library\n#include <cmath>\n#include <algorithm>\n#include <inttypes.h>\n\n//Win32 API\n#ifdef _WIN32\n#define NOMINMAX 1\n#define WIN32_LEAN_AND_MEAN 1\n#define PSAPI_VERSION 1\n#include <Windows.h>\n#include <Psapi.h>\n#endif\n\n//Enable extra logging output?\n#undef DEBUG_LOGGING\n\n//Constants\nstatic const VstInt32 CHANNEL_COUNT   = 2;\nstatic const VstInt32 PARAMETER_COUNT = 8;\nstatic const VstInt32 PROGRAM_COUNT   = 8;\n\n//Default\nstatic const char *DEFAULT_NAME = \"#$!__DEFAULT__!$#\";\nstatic const size_t INITIAL_BUFFER_SIZE = 8192;\n\n//Reg key\nstatic const wchar_t *REGISTRY_PATH = L\"Software\\\\MuldeR\\\\DynAudNorm\\\\VST\";\n\n//Critical Section\nstatic char g_loggingBuffer[1024];\nstatic MY_CRITSEC_INIT(g_loggingMutex);\n\n//Enumerations\nenum\n{\n\tPARAM_REALVAL = 0,\n\tPARAM_INTEGER = 1,\n\tPARAM_BOOLEAN = 2\n}\nparam_type_t;\n\n//Seed values\n#ifdef _M_X64\nstatic const uint64_t SEED_VALU1 = 0xC11D908A35A625A5, SEED_VALU2 = 0x5E57D080BCD2EAED;\n#else\nstatic const uint64_t SEED_VALU1 = 0x24575239D116386B, SEED_VALU2 = 0xE03BDD5B975F47D0;\n#endif\n\n//Debugging outputs\n#ifdef DEBUG_LOGGING\n#define DEBUG_LOG(...) outputMessage(__VA_ARGS__)\n#else\n#define DEBUG_LOG(...) ((void)0)\n#endif //DEBUG_LOGGING\n\n///////////////////////////////////////////////////////////////////////////////\n// Helper functions\n///////////////////////////////////////////////////////////////////////////////\n\nstatic void outputMessage(const char *const format, ...)\n{\n\tMY_CRITSEC_ENTER(g_loggingMutex);\n\n\tva_list argList;\n\tva_start(argList, format);\n\tvsnprintf_s(g_loggingBuffer, 1024, _TRUNCATE, format, argList);\n\tva_end(argList);\n\tOutputDebugStringA(g_loggingBuffer);\n\n\tMY_CRITSEC_LEAVE(g_loggingMutex);\n}\n\nstatic void logFunction(const int logLevel, const char *const message)\n{\n\tswitch (logLevel) \n\t{\n\tcase MDynamicAudioNormalizer::LOG_LEVEL_DBG:\n\t\toutputMessage(\"[DynAudNorm_VST] NFO: %s\\n\", message);\n\t\tbreak;\n\tcase MDynamicAudioNormalizer::LOG_LEVEL_WRN:\n\t\toutputMessage(\"[DynAudNorm_VST] WRN: %s\\n\", message);\n\t\tbreak;\n\tcase MDynamicAudioNormalizer::LOG_LEVEL_ERR:\n\t\toutputMessage(\"[DynAudNorm_VST] ERR: %s\\n\", message);\n\t\tbreak;\n\tdefault:\n\t\toutputMessage(\"[DynAudNorm_VST] DBG: %s\\n\", message);\n\t\tbreak;\n\t}\n}\n\nstatic void showErrorMsg(const char *const text)\n{\n\tMessageBoxA(NULL, text, \"Dynamic Audio Normalizer\", MB_ICONSTOP | MB_TOPMOST | MB_TASKMODAL);\n}\n\nstatic DWORD regValueGet(const wchar_t *const name)\n{\n\tDWORD result = 0; HKEY hKey = NULL;\n\tif(RegCreateKeyExW(HKEY_CURRENT_USER, REGISTRY_PATH, 0, NULL, 0, KEY_READ, NULL, &hKey, NULL) == ERROR_SUCCESS)\n\t{\n\t\tDWORD type = 0, value = 0, size = sizeof(DWORD);\n\t\tif(RegQueryValueExW(hKey, name, 0, &type, ((LPBYTE) &value), &size) == ERROR_SUCCESS)\n\t\t{\n\t\t\tif((type == REG_DWORD) && (size == sizeof(DWORD)))\n\t\t\t{\n\t\t\t\tresult = value;\n\t\t\t}\n\t\t}\n\t\tRegCloseKey(hKey);\n\t}\n\treturn result;\n}\n\nstatic bool regValueSet(const wchar_t *const name, const DWORD &value)\n{\n\tbool result = false; HKEY hKey = NULL;\n\tif(RegCreateKeyExW(HKEY_CURRENT_USER, REGISTRY_PATH, 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS)\n\t{\n\t\tif(RegSetValueExW(hKey, name, 0, REG_DWORD, ((LPBYTE) &value), sizeof(DWORD)) == ERROR_SUCCESS)\n\t\t{\n\t\t\tresult = true;\n\t\t}\n\t\tRegCloseKey(hKey);\n\t}\n\treturn result;\n}\n\nstatic bool getAppUuid(wchar_t *const uuidOut, const size_t &size)\n{\n\tif(size < 1)\n\t{\n\t\treturn false;\n\t}\n\n\twchar_t executableFilePath[512];\n\tif(GetProcessImageFileNameW(GetCurrentProcess(), executableFilePath, 512) < 1)\n\t{\n\t\twcsncpy_s(executableFilePath, 512, L\"Lorem ipsum dolor sit amet, consetetur sadipscing elitr!\", _TRUNCATE);\n\t}\n\n\tuint64_t hash1 = SEED_VALU1, hash2 = SEED_VALU2;\n\thash128(executableFilePath, &hash1, &hash2);\n\n\t_snwprintf_s(uuidOut, size, _TRUNCATE, L\"{%016llX-%016llX}\", hash1, hash2);\n\treturn true;\n}\n\nstatic VstInt32 getPlugUuid(void)\n{\n\tuint32_t major, minor, patch;\n\tMDynamicAudioNormalizer::getVersionInfo(major, minor, patch);\n\n\twchar_t identifier[128];\n\t_snwprintf_s(identifier, 128, _TRUNCATE, L\"muldersoft.com::DynamicAudioNormalizerVST::%u.%02u.%u\", major, minor, patch);\n\n\tuint64_t hash1 = SEED_VALU1, hash2 = SEED_VALU2;\n\thash128(identifier, &hash1, &hash2);\n\n\tconst VstInt32 hash32_pt1 = static_cast<VstInt32>(((hash1 ^ hash2) & 0xFFFFFFFF00000000ui64) >> 32);\n\tconst VstInt32 hash32_pt2 = static_cast<VstInt32>((hash1 ^ hash2) & 0x00000000FFFFFFFFui64);\n\t\n\treturn hash32_pt1 ^ hash32_pt2;\n}\n\ntemplate <typename T> static T *allocBuffer(size_t size)\n{\n\tT *buffer = NULL;\n\ttry\n\t{\n\t\tbuffer = new T[size];\n\t}\n\tcatch(...)\n\t{\n\t\toutputMessage(\"[DynAudNorm_VST] ERR: Allocation of size %u failed!\", static_cast<unsigned int>(sizeof(T) * size));\n\t\tshowErrorMsg(\"Memory allocation has failed: Out of memory!\");\n\t\t_exit(0xC0000017);\n\t}\n\treturn buffer;\n}\n\nstatic double applyStepSize(const double &val, const double &step)\n{\n\treturn (round(val / step) * step);\n}\n\nstatic double param2value(const double &min, const double &val, const double &max, const double &stepSize)\n{\n\tconst double offset = std::min(1.0, std::max(0.0, val)) * (max - min);\n\treturn min + ((stepSize > DBL_EPSILON) ? applyStepSize(offset, stepSize) : offset);\n}\n\nstatic float value2param(const double &min, const double &val, const double &max)\n{\n\tconst double targt = std::min(max, std::max(min, double(val)));\n\treturn static_cast<float>((targt - min) / (max - min));\n}\n\nstatic void value2string(char *text, const double &val, const double &min, const int &type, const bool &minDisable)\n{\n\tif(minDisable && (fabs(val - min) < DBL_EPSILON))\n\t{\n\t\t_snprintf_s(text, kVstMaxParamStrLen, _TRUNCATE, \"(OFF)\");\n\t\treturn;\n\t}\n\n\tswitch(type)\n\t{\n\tcase PARAM_REALVAL:\n\t\t_snprintf_s(text, kVstMaxParamStrLen, _TRUNCATE, \"%.2f\", val);\n\t\tbreak;\n\tcase PARAM_INTEGER:\n\t\t_snprintf_s(text, kVstMaxParamStrLen, _TRUNCATE, \"%d\", static_cast<int>(val));\n\t\tbreak;\n\tcase PARAM_BOOLEAN:\n\t\t_snprintf_s(text, kVstMaxParamStrLen, _TRUNCATE, \"%s\", (val >= 0.5) ? \"ON\" : \"OFF\");\n\t\tbreak;\n\tdefault:\n\t\t_snprintf_s(text, kVstMaxParamStrLen, _TRUNCATE, \"N/A\");\n\t}\n}\n\nstatic uint32_t value2integer(const double &val) { return static_cast<uint32_t>(round(val)); }\nstatic bool     value2boolean(const double &val) { return (val >= 0.5); }\n\n///////////////////////////////////////////////////////////////////////////////\n// Program Class\n///////////////////////////////////////////////////////////////////////////////\n\nstruct DynamicAudioNormalizerVST_Program\n{\n\tchar name[kVstMaxProgNameLen + 1];\n\tfloat param[PARAMETER_COUNT];\n};\n\n///////////////////////////////////////////////////////////////////////////////\n// Private Data\n///////////////////////////////////////////////////////////////////////////////\n\nclass DynamicAudioNormalizerVST_PrivateData\n{\n\tfriend class DynamicAudioNormalizerVST;\n\npublic:\n\tDynamicAudioNormalizerVST_PrivateData(void)\n\t{\n\t\tthis->instance = NULL;\n\t\tthis->programs = NULL;\n\t\tthis->temp[0] = this->temp[1] = NULL;\n\t\tthis->tempSize = 0;\n\t}\n\n\t~DynamicAudioNormalizerVST_PrivateData(void)\n\t{\n\t}\n\nprotected:\n\tMDynamicAudioNormalizer *instance;\n\tDynamicAudioNormalizerVST_Program *programs;\n\tdouble *temp[2];\n\tsize_t tempSize;\n};\n\n///////////////////////////////////////////////////////////////////////////////\n// Constructor & Destructor\n///////////////////////////////////////////////////////////////////////////////\n\nDynamicAudioNormalizerVST::DynamicAudioNormalizerVST(audioMasterCallback audioMaster)\n:\n\tAudioEffectX(audioMaster, PROGRAM_COUNT, PARAMETER_COUNT),\n\tp(new DynamicAudioNormalizerVST_PrivateData())\n{\n\toutputMessage(\"[DynAudNorm_VST] DynamicAudioNormalizerVST::DynamicAudioNormalizerVST()\");\n\tconst VstInt32 uniqueId = getPlugUuid();\n\n\tsetNumInputs(CHANNEL_COUNT);\t// stereo in\n\tsetNumOutputs(CHANNEL_COUNT);\t// stereo out\n\tsetUniqueID(uniqueId);\t\t\t// identify\n\tcanProcessReplacing();\t\t\t// supports replacing output\n\tcanDoubleReplacing();\t\t\t// supports double precision processing\n\tnoTail(false);\t\t\t\t\t// does have Tail!\n\n\tp->programs = allocBuffer<DynamicAudioNormalizerVST_Program>(PROGRAM_COUNT);\n\tfor(VstInt32 i = 0; i < PROGRAM_COUNT; i++)\n\t{\n\t\tvst_strncpy(p->programs[i].name, DEFAULT_NAME, kVstMaxProgNameLen);\n\t\tfor(VstInt32 j = 0; j < PARAMETER_COUNT; j++)\n\t\t{\n\t\t\tp->programs[i].param[j] = getParameterDefault(j);\n\t\t}\n\t}\n\n\tfor(size_t i = 0; i < 2; i++)\n\t{\n\t\tp->temp[i] = allocBuffer<double>(INITIAL_BUFFER_SIZE);\n\t}\n\t\n\tp->tempSize = INITIAL_BUFFER_SIZE;\n\tsetProgram(0);\n}\n\nDynamicAudioNormalizerVST::~DynamicAudioNormalizerVST()\n{\n\toutputMessage(\"[DynAudNorm_VST] DynamicAudioNormalizerVST::~DynamicAudioNormalizerVST()\");\n\n\tif(p->instance)\n\t{\n\t\tdelete p->instance;\n\t\tp->instance = NULL;\n\t}\n\n\tif(p->tempSize > 0)\n\t{\n\t\tfor(size_t i = 0; i < 2; i++)\n\t\t{\n\t\t\tdelete [] (p->temp[i]);\n\t\t\tp->temp[i] = NULL;\n\t\t}\n\t\tp->tempSize = 0;\n\t}\n\n\tif (p->programs)\n\t{\n\t\tdelete[] p->programs;\n\t\tp->programs = NULL;\n\t}\n\n\tdelete p;\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Program Handling\n///////////////////////////////////////////////////////////////////////////////\n\nvoid DynamicAudioNormalizerVST::setProgram(VstInt32 program)\n{\n\toutputMessage(\"[DynAudNorm_VST] DynamicAudioNormalizerVST::setProgramName(%d)\", program);\n\tAudioEffectX::setProgram(std::min(PROGRAM_COUNT-1, std::max(0, program)));\n\tforceUpdateParameters();\n}\n\nvoid DynamicAudioNormalizerVST::setProgramName (char* name)\n{\n\toutputMessage(\"[DynAudNorm_VST] DynamicAudioNormalizerVST::setProgramName()\");\n\tvst_strncpy(p->programs[curProgram].name, name, kVstMaxProgNameLen);\n}\n\nvoid DynamicAudioNormalizerVST::getProgramName (char* name)\n{\n\toutputMessage(\"[DynAudNorm_VST] DynamicAudioNormalizerVST::getProgramName()\");\n\n\tif(strcmp(p->programs[curProgram].name, DEFAULT_NAME) == 0)\n\t{\n\t\t_snprintf_s(name, kVstMaxProgNameLen, _TRUNCATE, \"Preset #%u\", curProgram + 1);\n\t}\n\telse\n\t{\n\t\tvst_strncpy(name, p->programs[curProgram].name, kVstMaxProgNameLen);\n\t}\n}\n\nbool DynamicAudioNormalizerVST::getProgramNameIndexed(VstInt32 category, VstInt32 index, char* text)\n{\n\toutputMessage(\"[DynAudNorm_VST] DynamicAudioNormalizerVST::getProgramNameIndexed(%d)\", index);\n\n\tif ((index >= 0) && (index < PROGRAM_COUNT))\n\t{\n\t\tif (strcmp(p->programs[index].name, DEFAULT_NAME) == 0)\n\t\t{\n\t\t\t_snprintf_s(text, kVstMaxProgNameLen, _TRUNCATE, \"Preset #%u\", index + 1);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvst_strncpy(text, p->programs[index].name, kVstMaxProgNameLen);\n\t\t}\n\t\treturn true;\n\t}\n\telse\n\t{\n\t\tvst_strncpy(text, \"N/A\", kVstMaxProgNameLen);\n\t\treturn false;\n\t}\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Parameter Handling\n///////////////////////////////////////////////////////////////////////////////\n\nstatic const struct\n{\n\tconst char *paramName;\n\tconst char *labelName;\n\tconst double minValue;\n\tconst double defValue;\n\tconst double maxValue;\n\tconst int contentType;\n\tconst bool minDisable;\n\tconst double stepSize;\n}\nPARAM_PROPERTIES[PARAMETER_COUNT] =\n{\n\t{ \"FrameLen\", \"MSec\",   100.00, 500.00, 1000.00, PARAM_INTEGER, false, 1.00 },\n\t{ \"FltrSize\", \"Frames\",   3.00,  31.00,   63.00, PARAM_INTEGER, false, 2.00 },\n\t{ \"PeakVal\",  \"%\",       10.00,  95.00,  100.00, PARAM_REALVAL, false, 0.00 },\n\t{ \"MaxAmpl\",  \"x\",        1.00,  10.00,   50.00, PARAM_REALVAL, false, 0.00 },\n\t{ \"TrgtRMS\",  \"%\",        0.00,   0.00,  100.00, PARAM_REALVAL, true,  0.00 },\n\t{ \"Compress\", \"sigma\",    0.00,   0.00,   25.00, PARAM_REALVAL, true,  0.00 },\n\t{ \"ChanCpld\", \"\",         0.00,   1.00,    1.00, PARAM_BOOLEAN, false, 1.00 },\n\t{ \"DCCorrct\", \"\",         0.00,   0.00,    1.00, PARAM_BOOLEAN, false, 1.00 }\n};\n\nvoid DynamicAudioNormalizerVST::getParameterName (VstInt32 index, char* label)\n{\n\toutputMessage(\"[DynAudNorm_VST] DynamicAudioNormalizerVST::getParameterName(%d)\", index);\n\n\tif ((index >= 0) && (index < PARAMETER_COUNT))\n\t{\n\t\tvst_strncpy(label, PARAM_PROPERTIES[index].paramName, kVstMaxParamStrLen);\n\t}\n\telse\n\t{\n\t\tvst_strncpy(label, \"N/A\", kVstMaxParamStrLen);\n\t}\n}\n\nvoid DynamicAudioNormalizerVST::getParameterLabel (VstInt32 index, char* label)\n{\n\toutputMessage(\"[DynAudNorm_VST] DynamicAudioNormalizerVST::getParameterLabel(%d)\", index);\n\n\tif ((index >= 0) && (index < PARAMETER_COUNT))\n\t{\n\t\tvst_strncpy(label, PARAM_PROPERTIES[index].labelName, kVstMaxParamStrLen);\n\t}\n\telse\n\t{\n\t\tvst_strncpy(label, \"N/A\", kVstMaxParamStrLen);\n\t}\n}\n\nvoid DynamicAudioNormalizerVST::setParameter (VstInt32 index, float value)\n{\n\toutputMessage(\"[DynAudNorm_VST] DynamicAudioNormalizerVST::setParameter(%d, %.2f)\", index, value);\n\n\tif ((index >= 0) && (index < PARAMETER_COUNT))\n\t{\n\t\tp->programs[curProgram].param[index] = std::min(1.0f, std::max(0.0f, value));\n\t}\n}\n\nfloat DynamicAudioNormalizerVST::getParameter(VstInt32 index)\n{\n\toutputMessage(\"[DynAudNorm_VST] DynamicAudioNormalizerVST::getParameter(%d)\", index);\n\n\tif ((index >= 0) && (index < PARAMETER_COUNT))\n\t{\n\t\treturn p->programs[curProgram].param[index];\n\t}\n\n\treturn -1.0;\n}\n\ndouble DynamicAudioNormalizerVST::getParameterValue(VstInt32 index)\n{\n\toutputMessage(\"[DynAudNorm_VST] DynamicAudioNormalizerVST::getParameterValue(%d)\", index);\n\n\tif ((index >= 0) && (index < PARAMETER_COUNT))\n\t{\n\t\t\n\t\treturn param2value(PARAM_PROPERTIES[index].minValue, p->programs[curProgram].param[index], PARAM_PROPERTIES[index].maxValue, PARAM_PROPERTIES[index].stepSize);\n\t}\n\n\treturn -1.0;\n}\n\nfloat DynamicAudioNormalizerVST::getParameterDefault(VstInt32 index)\n{\n\toutputMessage(\"[DynAudNorm_VST] DynamicAudioNormalizerVST::getParameterDefault(%d)\", index);\n\n\tif ((index >= 0) && (index < PARAMETER_COUNT))\n\t{\n\t\t\n\t\treturn value2param(PARAM_PROPERTIES[index].minValue, PARAM_PROPERTIES[index].defValue, PARAM_PROPERTIES[index].maxValue);\n\t}\n\n\treturn -1.0;\n}\n\nvoid DynamicAudioNormalizerVST::getParameterDisplay(VstInt32 index, char* text)\n{\n\toutputMessage(\"[DynAudNorm_VST] DynamicAudioNormalizerVST::getParameterDisplay(%d)\", index);\n\n\ttext[0] = '\\0';\n\tif ((index >= 0) && (index < PARAMETER_COUNT))\n\t{\n\t\tvalue2string(text, getParameterValue(index), PARAM_PROPERTIES[index].minValue, PARAM_PROPERTIES[index].contentType, PARAM_PROPERTIES[index].minDisable);\n\t}\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Effect Info\n///////////////////////////////////////////////////////////////////////////////\n\nbool DynamicAudioNormalizerVST::getEffectName (char* name)\n{\n\toutputMessage(\"[DynAudNorm_VST] DynamicAudioNormalizerVST::getEffectName()\");\n\n\tuint32_t major, minor, patch;\n\tMDynamicAudioNormalizer::getVersionInfo(major, minor, patch);\n\t_snprintf_s(name, kVstMaxEffectNameLen, _TRUNCATE, \"DynamicAudioNormalizer %u.%02u-%u\", major, minor, patch);\n\treturn true;\n}\n\nbool DynamicAudioNormalizerVST::getProductString (char* text)\n{\n\toutputMessage(\"[DynAudNorm_VST] DynamicAudioNormalizerVST::getProductString()\");\n\n\tuint32_t major, minor, patch;\n\tMDynamicAudioNormalizer::getVersionInfo(major, minor, patch);\n\t_snprintf_s(text, kVstMaxProductStrLen, _TRUNCATE, \"DynamicAudioNormalizer_%u\", (100U * major) + minor);\n\treturn true;\n}\n\nbool DynamicAudioNormalizerVST::getVendorString (char* text)\n{\n\toutputMessage(\"[DynAudNorm_VST] DynamicAudioNormalizerVST::getVendorString()\");\n\n\tstatic const char *vendorName = \"LoRd_MuldeR\";\n\t_snprintf_s(text, kVstMaxVendorStrLen, _TRUNCATE, \"%s\", vendorName);\n\treturn true;\n}\n\nVstInt32 DynamicAudioNormalizerVST::getVendorVersion ()\n{ \n\toutputMessage(\"[DynAudNorm_VST] DynamicAudioNormalizerVST::getVendorVersion()\");\n\n\tuint32_t major, minor, patch;\n\tMDynamicAudioNormalizer::getVersionInfo(major, minor, patch);\n\treturn (major * 1000U) + (minor * 10U) + patch;\n}\n\nVstPlugCategory DynamicAudioNormalizerVST::getPlugCategory(void)\n{\n\toutputMessage(\"[DynAudNorm_VST] DynamicAudioNormalizerVST::getPlugCategory()\");\n\treturn kPlugCategEffect;\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// State Handling\n///////////////////////////////////////////////////////////////////////////////\n\nvoid DynamicAudioNormalizerVST::open(void)\n{\n\toutputMessage(\"[DynAudNorm_VST] DynamicAudioNormalizerVST::open()\");\n\tforceUpdateParameters();\n}\n\nvoid DynamicAudioNormalizerVST::close(void)\n{\n\toutputMessage(\"[DynAudNorm_VST] DynamicAudioNormalizerVST::close()\");\n\n\tif(p->instance)\n\t{\n\t\toutputMessage(\"[DynAudNorm_VST] ISANITY:  Host called close() after resume() *without* intermittent susped() call -> workaround actived!\");\n\t\tsuspend();\n\t}\n}\n\nvoid DynamicAudioNormalizerVST::resume(void)\n{\n\toutputMessage(\"[DynAudNorm_VST] DynamicAudioNormalizerVST::resume()\");\n\n\tif(p->instance)\n\t{\n\t\toutputMessage(\"[DynAudNorm_VST] ISANITY: Host called resume() repeatedly *without* intermittent susped() call -> workaround actived!\");\n\t\tsuspend();\n\t}\n\n\tif(createNewInstance(static_cast<uint32_t>(round(getSampleRate()))))\n\t{\n\t\tint64_t delayInSamples;\n\t\tif(p->instance->getInternalDelay(delayInSamples))\n\t\t{\n\t\t\tsetInitialDelay(static_cast<VstInt32>(std::min(delayInSamples, int64_t(INT32_MAX))));\n\t\t}\n\t}\n}\n\nvoid DynamicAudioNormalizerVST::suspend(void)\n{\n\toutputMessage(\"[DynAudNorm_VST] DynamicAudioNormalizerVST::suspend()\");\n\n\tif(p->instance)\n\t{\n\t\tdelete p->instance;\n\t\tp->instance = NULL;\n\t}\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Audio Processing\n///////////////////////////////////////////////////////////////////////////////\n\nvoid DynamicAudioNormalizerVST::processReplacing(float** inputs, float** outputs, VstInt32 sampleFrames)\n{\n\tDEBUG_LOG(\"[DynAudNorm_VST] ENTER >>> processReplacing()\");\n\n\tif(sampleFrames < 1)\n\t{\n\t\treturn; /*number of samples is zero or even negative!*/\n\t}\n\n\tif(!p->instance)\n\t{\n\t\toutputMessage(\"[DynAudNorm_VST] ISANITY: Host called processReplacing() *before* resume() has been called -> workaround actived!\");\n\t\tresume();\n\t}\n\n\tupdateBufferSize(sampleFrames);\n\treadInputSamplesFlt(inputs, sampleFrames);\n\n\tint64_t outputSamples;\n\tif(!p->instance->processInplace(p->temp, sampleFrames, outputSamples))\n\t{\n\t\tshowErrorMsg(\"Dynamic Audio Normalizer processing failed!\");\n\t\tDEBUG_LOG(\"[DynAudNorm_VST] LEAVE <<< processReplacing()\");\n\t\treturn;\n\t}\n\n\tDEBUG_LOG(\"InputSamples/OutputSamples: %llu/%llu --> %llu\", int64_t(sampleFrames), outputSamples, int64_t(sampleFrames) - outputSamples);\n\twriteOutputSamplesFlt(outputs, sampleFrames, outputSamples);\n\n\tDEBUG_LOG(\"[DynAudNorm_VST] LEAVE <<< processReplacing()\");\n}\n\nvoid DynamicAudioNormalizerVST::processDoubleReplacing (double** inputs, double** outputs, VstInt32 sampleFrames)\n{\n\tDEBUG_LOG(\"[DynAudNorm_VST] ENTER >>> processDoubleReplacing()\");\n\n\tif(sampleFrames < 1)\n\t{\n\t\treturn; /*number of samples is zero or even negative!*/\n\t}\n\n\tif(!p->instance)\n\t{\n\t\toutputMessage(\"[DynAudNorm_VST] ISANITY: Host called processReplacing() *before* resume() has been called -> workaround actived!\");\n\t\tresume();\n\t}\n\n\tupdateBufferSize(sampleFrames);\n\treadInputSamplesDbl(inputs, sampleFrames);\n\n\tint64_t outputSamples;\n\tif(!p->instance->processInplace(p->temp, sampleFrames, outputSamples))\n\t{\n\t\tshowErrorMsg(\"Dynamic Audio Normalizer processing failed!\");\n\t\tDEBUG_LOG(\"[DynAudNorm_VST] LEAVE <<< processDoubleReplacing()\");\n\t\treturn;\n\t}\n\n\twriteOutputSamplesDbl(outputs, sampleFrames, outputSamples);\n\n\tDEBUG_LOG(\"[DynAudNorm_VST] LEAVE <<< processDoubleReplacing()\");\n}\n\nVstInt32 DynamicAudioNormalizerVST::getGetTailSize(void)\n{\n\toutputMessage(\"[DynAudNorm_VST] DynamicAudioNormalizerVST::getGetTailSize()\");\n\n\tif(p->instance)\n\t{\n\t\tint64_t delayInSamples;\n\t\tif(p->instance->getInternalDelay(delayInSamples))\n\t\t{\n\t\t\treturn static_cast<VstInt32>(delayInSamples);\n\t\t}\n\t}\n\treturn 0;\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Internal Functions\n///////////////////////////////////////////////////////////////////////////////\n\nbool DynamicAudioNormalizerVST::createNewInstance(const uint32_t sampleRate)\n{\n\tif(p->instance)\n\t{\n\t\tshowErrorMsg(\"Dynamic Audio Normalizer instance already created!\");\n\t\treturn true;\n\t}\n\t\n\tconst DynamicAudioNormalizerVST_Program *const currentProg = &p->programs[curProgram];\n\n\ttry\n\t{\n\t\tp->instance = new MDynamicAudioNormalizer\n\t\t(\n\t\t\tCHANNEL_COUNT,\n\t\t\tsampleRate,\n\t\t\tvalue2integer(getParameterValue(0)),\n\t\t\tvalue2integer(getParameterValue(1)),\n\t\t\tgetParameterValue(2) / 100.0,\n\t\t\tgetParameterValue(3),\n\t\t\tgetParameterValue(4) / 100.0,\n\t\t\tgetParameterValue(5),\n\t\t\tvalue2boolean(getParameterValue(6)),\n\t\t\tvalue2boolean(getParameterValue(7))\n\t\t);\n\t}\n\tcatch(...)\n\t{\n\t\tshowErrorMsg(\"Failed to create Dynamic Audio Normalizer instance!\");\n\t\treturn false;\n\t}\n\n\tif(!p->instance->initialize())\n\t{\n\t\tshowErrorMsg(\"Dynamic Audio Normalizer initialization has failed!\");\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\nvoid DynamicAudioNormalizerVST::updateBufferSize(const size_t requiredSize)\n{\n\tif(p->tempSize < requiredSize)\n\t{\n\t\toutputMessage(\"[DynAudNorm_VST] WRN: Increasing internal buffer size: %u -> %u\", ((unsigned int)p->tempSize), ((unsigned int)requiredSize));\n\t\tfor(size_t i = 0; i < 2; i++)\n\t\t{\n\t\t\tif(p->tempSize > 0)\n\t\t\t{\n\t\t\t\tdelete [] (p->temp[i]);\n\t\t\t}\n\t\t\ttry\n\t\t\t{\n\t\t\t\tp->temp[i] = allocBuffer<double>(requiredSize);\n\t\t\t}\n\t\t\tcatch(...)\n\t\t\t{\n\t\t\t\toutputMessage(\"[DynAudNorm_VST] ERR: Allocation of size %u failed!\", (unsigned int)(sizeof(double) * requiredSize));\n\t\t\t\tshowErrorMsg(\"Memory allocation has failed: Out of memory!\");\n\t\t\t\t_exit(0xC0000017);\n\t\t\t}\n\t\t}\n\t\tp->tempSize = requiredSize;\n\t}\n}\n\nvoid DynamicAudioNormalizerVST::readInputSamplesFlt(const float *const *const inputs, const int64_t sampleCount)\n{\n\tfor(size_t c = 0; c < 2; c++)\n\t{\n\t\tfor(int64_t i = 0; i < sampleCount; i++)\n\t\t{\n\t\t\tp->temp[c][i] = inputs[c][i];\n\t\t}\n\t}\n}\n\nvoid DynamicAudioNormalizerVST::readInputSamplesDbl(const double *const *const inputs, const int64_t sampleCount)\n{\n\tfor(size_t c = 0; c < 2; c++)\n\t{\n\t\tmemcpy(&p->temp[c][0], &inputs[c][0], sizeof(double) * size_t(sampleCount));\n\t}\n}\n\nvoid DynamicAudioNormalizerVST::writeOutputSamplesFlt(float *const *const outputs, const int64_t requiredSamples, const int64_t availableSamples)\n{\n\tif(availableSamples == 0)\n\t{\n\t\tfor(size_t c = 0; c < 2; c++)\n\t\t{\n\t\t\tmemset(&outputs[c][0], 0, sizeof(float) * size_t(requiredSamples));\n\t\t}\n\t}\n\telse if(availableSamples < requiredSamples)\n\t{\n\t\tconst int64_t offset = requiredSamples - availableSamples;\n\t\tfor(size_t c = 0; c < 2; c++)\n\t\t{\n\t\t\tmemset(&outputs[c][0], 0, sizeof(float) * size_t(offset));\n\t\t\tfloat *outPtr = &outputs[c][offset];\n\t\t\tfor(int64_t i = 0; i < availableSamples; i++)\n\t\t\t{\n\t\t\t\t*(outPtr++) = static_cast<float>(p->temp[c][i]);\n\t\t\t}\n\t\t}\n\t}\n\telse if(availableSamples == requiredSamples)\n\t{\n\t\tfor(size_t c = 0; c < 2; c++)\n\t\t{\n\t\t\tfor(int64_t i = 0; i < availableSamples; i++)\n\t\t\t{\n\t\t\t\toutputs[c][i] = static_cast<float>(p->temp[c][i]);\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tshowErrorMsg(\"Number of output samples exceeds output buffer size!\");\n\t}\n}\n\nvoid DynamicAudioNormalizerVST::writeOutputSamplesDbl(double *const *const outputs, const int64_t requiredSamples, const int64_t availableSamples)\n{\n\tif(availableSamples == 0)\n\t{\n\t\tfor(size_t c = 0; c < 2; c++)\n\t\t{\n\t\t\tmemset(&outputs[c][0], 0, sizeof(double) * size_t(requiredSamples));\n\t\t}\n\t}\n\telse if(availableSamples < requiredSamples)\n\t{\n\t\tconst int64_t offset = requiredSamples - availableSamples;\n\t\tfor(size_t c = 0; c < 2; c++)\n\t\t{\n\t\t\tmemset(&outputs[c][0], 0, sizeof(double) * size_t(offset));\n\t\t\tmemcpy(&outputs[c][offset], &p->temp[c][0], sizeof(double) * size_t(availableSamples));\n\t\t}\n\t}\n\telse if(availableSamples == requiredSamples)\n\t{\n\t\tfor(size_t c = 0; c < 2; c++)\n\t\t{\n\t\t\tmemcpy(&outputs[c][0], &p->temp[c][0], sizeof(double) * size_t(availableSamples));\n\t\t}\n\t}\n\telse\n\t{\n\t\tshowErrorMsg(\"Number of output samples exceeds output buffer size!\");\n\t}\n}\n\nvoid DynamicAudioNormalizerVST::forceUpdateParameters(void)\n{\n\tfor(VstInt32 i = 0; i < PARAMETER_COUNT; i++)\n\t{\n\t\tbeginEdit(i);\n\t\tsetParameterAutomated(i, p->programs[curProgram].param[i]);\n\t\tendEdit(i);\n\t}\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Create Instance\n///////////////////////////////////////////////////////////////////////////////\n\nstatic int8_t g_initialized = -1;\nstatic MY_CRITSEC_INIT(g_createEffMutex);\n\nstatic void appendStr(wchar_t *buffer, const size_t &size, const wchar_t *const text, ...)\n{\n\twchar_t temp[128];\n\tva_list argList;\n\tva_start(argList, text);\n\t_vsnwprintf_s(temp, 128, _TRUNCATE, text, argList);\n\tva_end(argList);\n\twcsncat_s(buffer, size, temp, _TRUNCATE);\n}\n\nstatic bool showAboutScreen(const uint32_t & major, const uint32_t & minor, const uint32_t & patch, const char *const date, const char *const time, const char *const compiler, const char *const arch, const bool &debug)\n{\n\twchar_t text[1024] = { '\\0' };\n\tappendStr(text, 1024, L\"Dynamic Audio Normalizer, VST Wrapper, Version %u.%02u-%u, %s\\n\", major, minor, patch, (debug ? L\"DEBGU\" : L\"Release\"));\n\tappendStr(text, 1024, L\"Copyright (c) 2014-%S LoRd_MuldeR <mulder2@gmx.de>.\\n\", &date[7]);\n\tappendStr(text, 1024, L\"Built on %S at %S with %S for %S.\\n\\n\", date, time, compiler, arch);\n\tappendStr(text, 1024, L\"This library is free software; you can redistribute it and/or\\n\");\n\tappendStr(text, 1024, L\"modify it under the terms of the GNU Lesser General Public\\n\");\n\tappendStr(text, 1024, L\"License as published by the Free Software Foundation; either\\n\");\n\tappendStr(text, 1024, L\"version 2.1 of the License, or (at your option) any later version.\\n\\n\");\n\tappendStr(text, 1024, L\"This library is distributed in the hope that it will be useful,\\n\");\n\tappendStr(text, 1024, L\"but WITHOUT ANY WARRANTY; without even the implied warranty of\\n\");\n\tappendStr(text, 1024, L\"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\\n\");\n\tappendStr(text, 1024, L\"Lesser General Public License for more details.\\n\\n\");\n\tappendStr(text, 1024, L\"Please click 'OK' if you agree to the above notice or 'Cancel' otherwise...\\n\");\n\n\treturn (MessageBoxW(NULL, text, L\"Dynamic Audio Normalizer\", MB_SYSTEMMODAL | MB_OKCANCEL | MB_DEFBUTTON2) == IDOK);\n}\n\nstatic bool initializeCoreLibrary(void)\n{\n\tMDynamicAudioNormalizer::setLogFunction(logFunction);\n\n\tuint32_t major, minor, patch;\n\tMDynamicAudioNormalizer::getVersionInfo(major, minor, patch);\n\toutputMessage(\"[DynAudNorm_VST] Dynamic Audio Normalizer VST-Wrapper (v%u.%02u-%u)\", major, minor, patch);\n\n\twchar_t appUuid[64];\n\tif(getAppUuid(appUuid, 64))\n\t{\n\t\tconst DWORD version = (1000u * major) + (10u * minor) + patch;\n\t\tif(regValueGet(appUuid) != version)\n\t\t{\n\t\t\tconst char *date, *time, *compiler, *arch; bool debug;\n\t\t\tMDynamicAudioNormalizer::getBuildInfo(&date, &time, &compiler, &arch, debug);\n\n\t\t\tif(!showAboutScreen(major, minor, patch, date, time, compiler, arch, debug))\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tregValueSet(appUuid, version);\n\t\t}\n\t}\n\n\treturn true;\n}\n\nAudioEffect* createEffectInstance(audioMasterCallback audioMaster)\n{\n\tMY_CRITSEC_ENTER(g_createEffMutex);\n\tAudioEffect *effectInstance = NULL;\n\n\tif(g_initialized < 0)\n\t{\n\t\tg_initialized = initializeCoreLibrary() ? 1 : 0;\n\t}\n\t\n\tif(g_initialized > 0)\n\t{\n\t\teffectInstance = new DynamicAudioNormalizerVST(audioMaster);\n\t}\n\t\n\tMY_CRITSEC_LEAVE(g_createEffMutex);\n\treturn effectInstance;\n}\n"
  },
  {
    "path": "DynamicAudioNormalizerVST/src/DynamicAudioNormalizerVST.h",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - VST 2.x Wrapper\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n// http://opensource.org/licenses/MIT\n//////////////////////////////////////////////////////////////////////////////////\n\n//////////////////////////////////////////////////////////////////////////////////\n// ACKNOWLEDGEMENT:\n// (1) VST PlugIn Interface Technology by Steinberg Media Technologies GmbH.\n// (2) VST is a trademark of Steinberg Media Technologies GmbH.\n//////////////////////////////////////////////////////////////////////////////////\n\n#ifndef DYNAMICAUDIONORMALIZERVST_H\n#define DYNAMICAUDIONORMALIZERVST_H\n\n//VST SDK includes\n#include \"public.sdk/source/vst2.x/audioeffectx.h\"\n\n//Forward declaration\nclass DynamicAudioNormalizerVST_PrivateData;\n\n//Standard Lib\n#include <stdint.h>\n\nclass DynamicAudioNormalizerVST : public AudioEffectX\n{\npublic:\n\tDynamicAudioNormalizerVST(audioMasterCallback audioMaster);\n\t~DynamicAudioNormalizerVST();\n\n\tvirtual void open(void);\n\tvirtual void close(void);\n\tvirtual void suspend(void);\n\tvirtual void resume(void);\n\n\t// Processing\n\tvirtual void processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames);\n\tvirtual void processDoubleReplacing (double** inputs, double** outputs, VstInt32 sampleFrames);\n\tvirtual VstInt32 getGetTailSize(void);\n\n\t// Program\n\tvirtual void setProgram(VstInt32 program);\n\tvirtual void setProgramName (char* name);\n\tvirtual void getProgramName (char* name);\n\tvirtual bool getProgramNameIndexed(VstInt32 category, VstInt32 index, char* text);\n\n\t// Parameters\n\tvirtual void setParameter(VstInt32 index, float value);\n\tvirtual float getParameter(VstInt32 index);\n\tvirtual float getParameterDefault(VstInt32 index);\n\tvirtual double getParameterValue(VstInt32 index);\n\tvirtual void getParameterLabel(VstInt32 index, char* label);\n\tvirtual void getParameterDisplay(VstInt32 index, char* text);\n\tvirtual void getParameterName(VstInt32 index, char* text);\n\n\t// Information\n\tvirtual bool getEffectName (char* name);\n\tvirtual bool getVendorString (char* text);\n\tvirtual bool getProductString (char* text);\n\tvirtual VstInt32 getVendorVersion(void);\n\tvirtual VstPlugCategory getPlugCategory(void);\n\nprivate:\n\tbool createNewInstance(const uint32_t sampleRate);\n\tvoid updateBufferSize(const size_t requiredSize);\n\tvoid readInputSamplesFlt(const float  *const *const inputs, const int64_t sampleCount);\n\tvoid readInputSamplesDbl(const double *const *const inputs, const int64_t sampleCount);\n\tvoid writeOutputSamplesFlt(float  *const *const outputs, const int64_t requiredSamples, const int64_t availableSamples);\n\tvoid writeOutputSamplesDbl(double *const *const outputs, const int64_t requiredSamples, const int64_t availableSamples);\n\tvoid forceUpdateParameters(void);\n\n\tDynamicAudioNormalizerVST_PrivateData *const p;\n};\n\n#endif //DYNAMICAUDIONORMALIZERVST_H\n"
  },
  {
    "path": "DynamicAudioNormalizerVST/src/Spooky.cpp",
    "content": "// Spooky Hash\n// A 128-bit noncryptographic hash, for checksums and table lookup\n// By Bob Jenkins.  Public domain.\n//\n// This is a stripped-down version derived from the original source code. Find the original code at:\n// http://burtleburtle.net/bob/hash/spooky.html\n\n#include \"Spooky.h\"\n#include <cstring>\n\n#define ALLOW_UNALIGNED_READS 1\n\nstatic const size_t sc_numVars = 12;\nstatic const size_t sc_blockSize = sc_numVars*8;\nstatic const size_t sc_bufSize = 2*sc_blockSize;\nstatic const uint64_t sc_const = 0xdeadbeefdeadbeefLL;\n\nstatic inline uint64_t Rot64(uint64_t x, int k)\n{\n\treturn (x << k) | (x >> (64 - k));\n}\n\nstatic inline void Mix\n(\n\tconst uint64_t *data,\n\tuint64_t &s0, uint64_t &s1, uint64_t & s2, uint64_t & s3,\n\tuint64_t &s4, uint64_t &s5, uint64_t & s6, uint64_t & s7,\n\tuint64_t &s8, uint64_t &s9, uint64_t &s10, uint64_t &s11\n)\n{\n\ts0 += data[0];   s2  ^= s10; s11 ^= s0;   s0 = Rot64(s0,  11); s11 +=  s1;\n\ts1 += data[1];   s3  ^= s11; s0  ^= s1;   s1 = Rot64(s1,  32);  s0 +=  s2;\n\ts2 += data[2];   s4  ^= s0;  s1  ^= s2;   s2 = Rot64(s2,  43);  s1 +=  s3;\n\ts3 += data[3];   s5  ^= s1;  s2  ^= s3;   s3 = Rot64(s3,  31);  s2 +=  s4;\n\ts4 += data[4];   s6  ^= s2;  s3  ^= s4;   s4 = Rot64(s4,  17);  s3 +=  s5;\n\ts5 += data[5];   s7  ^= s3;  s4  ^= s5;   s5 = Rot64(s5,  28);  s4 +=  s6;\n\ts6 += data[6];   s8  ^= s4;  s5  ^= s6;   s6 = Rot64(s6,  39);  s5 +=  s7;\n\ts7 += data[7];   s9  ^= s5;  s6  ^= s7;   s7 = Rot64(s7,  57);  s6 +=  s8;\n\ts8 += data[8];   s10 ^= s6;  s7  ^= s8;   s8 = Rot64(s8,  55);  s7 +=  s9;\n\ts9 += data[9];   s11 ^= s7;  s8  ^= s9;   s9 = Rot64(s9,  54);  s8 += s10;\n\ts10 += data[10]; s0  ^= s8;  s9  ^= s10; s10 = Rot64(s10, 22);  s9 += s11;\n\ts11 += data[11]; s1  ^= s9;  s10 ^= s11; s11 = Rot64(s11, 46); s10 +=  s0;\n}\n\nstatic inline void ShortMix(uint64_t &h0, uint64_t &h1, uint64_t &h2, uint64_t &h3)\n{\n\th2 = Rot64(h2,50);  h2 += h3;  h0 ^= h2;\n\th3 = Rot64(h3,52);  h3 += h0;  h1 ^= h3;\n\th0 = Rot64(h0,30);  h0 += h1;  h2 ^= h0;\n\th1 = Rot64(h1,41);  h1 += h2;  h3 ^= h1;\n\th2 = Rot64(h2,54);  h2 += h3;  h0 ^= h2;\n\th3 = Rot64(h3,48);  h3 += h0;  h1 ^= h3;\n\th0 = Rot64(h0,38);  h0 += h1;  h2 ^= h0;\n\th1 = Rot64(h1,37);  h1 += h2;  h3 ^= h1;\n\th2 = Rot64(h2,62);  h2 += h3;  h0 ^= h2;\n\th3 = Rot64(h3,34);  h3 += h0;  h1 ^= h3;\n\th0 = Rot64(h0, 5);  h0 += h1;  h2 ^= h0;\n\th1 = Rot64(h1,36);  h1 += h2;  h3 ^= h1;\n}\n\nstatic inline void ShortEnd(uint64_t &h0, uint64_t &h1, uint64_t &h2, uint64_t &h3)\n{\n\th3 ^= h2;  h2 = Rot64(h2,15);  h3 += h2;\n\th0 ^= h3;  h3 = Rot64(h3,52);  h0 += h3;\n\th1 ^= h0;  h0 = Rot64(h0,26);  h1 += h0;\n\th2 ^= h1;  h1 = Rot64(h1,51);  h2 += h1;\n\th3 ^= h2;  h2 = Rot64(h2,28);  h3 += h2;\n\th0 ^= h3;  h3 = Rot64(h3, 9);  h0 += h3;\n\th1 ^= h0;  h0 = Rot64(h0,47);  h1 += h0;\n\th2 ^= h1;  h1 = Rot64(h1,54);  h2 += h1;\n\th3 ^= h2;  h2 = Rot64(h2,32);  h3 += h2;\n\th0 ^= h3;  h3 = Rot64(h3,25);  h0 += h3;\n\th1 ^= h0;  h0 = Rot64(h0,63);  h1 += h0;\n}\n\nstatic void Short(const void *message, size_t length, uint64_t *hash1, uint64_t *hash2)\n{\n\tuint64_t buf[2 * sc_numVars];\n\tunion\n\t{\n\t\tconst uint8_t *p8;\n\t\tuint32_t *p32;\n\t\tuint64_t *p64;\n\t\tsize_t i;\n\t} u;\n\n\tu.p8 = (const uint8_t *)message;\n\n\tif (!ALLOW_UNALIGNED_READS && (u.i & 0x7))\n\t{\n\t\tmemcpy(buf, message, length);\n\t\tu.p64 = buf;\n\t}\n\n\tsize_t remainder = length % 32;\n\tuint64_t a = *hash1;\n\tuint64_t b = *hash2;\n\tuint64_t c = sc_const;\n\tuint64_t d = sc_const;\n\n\tif (length > 15)\n\t{\n\t\tconst uint64_t *end = u.p64 + (length / 32) * 4;\n\n\t\t// handle all complete sets of 32 bytes\n\t\tfor (; u.p64 < end; u.p64 += 4)\n\t\t{\n\t\t\tc += u.p64[0];\n\t\t\td += u.p64[1];\n\t\t\tShortMix(a, b, c, d);\n\t\t\ta += u.p64[2];\n\t\t\tb += u.p64[3];\n\t\t}\n\n\t\t//Handle the case of 16+ remaining bytes.\n\t\tif (remainder >= 16)\n\t\t{\n\t\t\tc += u.p64[0];\n\t\t\td += u.p64[1];\n\t\t\tShortMix(a, b, c, d);\n\t\t\tu.p64 += 2;\n\t\t\tremainder -= 16;\n\t\t}\n\t}\n\n\t// Handle the last 0..15 bytes, and its length\n\td += ((uint64_t)length) << 56;\n\tswitch (remainder)\n\t{\n\tcase 15:\n\t\td += ((uint64_t)u.p8[14]) << 48;\n\tcase 14:\n\t\td += ((uint64_t)u.p8[13]) << 40;\n\tcase 13:\n\t\td += ((uint64_t)u.p8[12]) << 32;\n\tcase 12:\n\t\td += u.p32[2];\n\t\tc += u.p64[0];\n\t\tbreak;\n\tcase 11:\n\t\td += ((uint64_t)u.p8[10]) << 16;\n\tcase 10:\n\t\td += ((uint64_t)u.p8[9]) << 8;\n\tcase 9:\n\t\td += (uint64_t)u.p8[8];\n\tcase 8:\n\t\tc += u.p64[0];\n\t\tbreak;\n\tcase 7:\n\t\tc += ((uint64_t)u.p8[6]) << 48;\n\tcase 6:\n\t\tc += ((uint64_t)u.p8[5]) << 40;\n\tcase 5:\n\t\tc += ((uint64_t)u.p8[4]) << 32;\n\tcase 4:\n\t\tc += u.p32[0];\n\t\tbreak;\n\tcase 3:\n\t\tc += ((uint64_t)u.p8[2]) << 16;\n\tcase 2:\n\t\tc += ((uint64_t)u.p8[1]) << 8;\n\tcase 1:\n\t\tc += (uint64_t)u.p8[0];\n\t\tbreak;\n\tcase 0:\n\t\tc += sc_const;\n\t\td += sc_const;\n\t}\n\tShortEnd(a, b, c, d);\n\t*hash1 = a;\n\t*hash2 = b;\n}\n\nstatic inline void EndPartial\n(\n\tuint64_t &h0, uint64_t &h1, uint64_t & h2, uint64_t & h3,\n\tuint64_t &h4, uint64_t &h5, uint64_t & h6, uint64_t & h7,\n\tuint64_t &h8, uint64_t &h9, uint64_t &h10, uint64_t &h11\n)\n{\n\th11+=  h1;  h2 ^= h11;  h1 = Rot64( h1,44);\n\th0 +=  h2;  h3 ^=  h0;  h2 = Rot64( h2,15);\n\th1 +=  h3;  h4 ^=  h1;  h3 = Rot64( h3,34);\n\th2 +=  h4;  h5 ^=  h2;  h4 = Rot64( h4,21);\n\th3 +=  h5;  h6 ^=  h3;  h5 = Rot64( h5,38);\n\th4 +=  h6;  h7 ^=  h4;  h6 = Rot64( h6,33);\n\th5 +=  h7;  h8 ^=  h5;  h7 = Rot64( h7,10);\n\th6 +=  h8;  h9 ^=  h6;  h8 = Rot64( h8,13);\n\th7 +=  h9; h10 ^=  h7;  h9 = Rot64( h9,38);\n\th8 += h10; h11 ^=  h8; h10 = Rot64(h10,53);\n\th9 += h11;  h0 ^=  h9; h11 = Rot64(h11,42);\n\th10+=  h0;  h1 ^= h10;  h0 = Rot64( h0,54);\n}\n\nstatic inline void End\n(\n\tconst uint64_t *data,\n\tuint64_t &h0, uint64_t &h1, uint64_t &h2,  uint64_t & h3,\n\tuint64_t &h4, uint64_t &h5, uint64_t &h6,  uint64_t & h7,\n\tuint64_t &h8, uint64_t &h9, uint64_t &h10, uint64_t &h11\n)\n{\n\th0 += data[0]; h1 += data[1];  h2 += data [2];  h3 += data [3];\n\th4 += data[4]; h5 += data[5];  h6 += data [6];  h7 += data [7];\n\th8 += data[8]; h9 += data[9]; h10 += data[10]; h11 += data[11];\n\tEndPartial(h0,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11);\n\tEndPartial(h0,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11);\n\tEndPartial(h0,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11);\n}\n\nvoid hash128(const void *const message, size_t length, uint64_t *hash1, uint64_t *hash2)\n{\n\tif (length < sc_bufSize)\n\t{\n\t\tShort(message, length, hash1, hash2);\n\t\treturn;\n\t}\n\n\tuint64_t h0, h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11;\n\tuint64_t buf[sc_numVars];\n\tuint64_t *end;\n\tunion\n\t{\n\t\tconst uint8_t *p8;\n\t\tuint64_t *p64;\n\t\tsize_t i;\n\t} u;\n\tsize_t remainder;\n\n\th0 = h3 = h6 = h9 = *hash1;\n\th1 = h4 = h7 = h10 = *hash2;\n\th2 = h5 = h8 = h11 = sc_const;\n\n\tu.p8 = (const uint8_t *)message;\n\tend = u.p64 + (length / sc_blockSize)*sc_numVars;\n\n\t// handle all whole sc_blockSize blocks of bytes\n\tif (ALLOW_UNALIGNED_READS || ((u.i & 0x7) == 0))\n\t{\n\t\twhile (u.p64 < end)\n\t\t{\n\t\t\tMix(u.p64, h0, h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11);\n\t\t\tu.p64 += sc_numVars;\n\t\t}\n\t}\n\telse\n\t{\n\t\twhile (u.p64 < end)\n\t\t{\n\t\t\tmemcpy(buf, u.p64, sc_blockSize);\n\t\t\tMix(buf, h0, h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11);\n\t\t\tu.p64 += sc_numVars;\n\t\t}\n\t}\n\n\t// handle the last partial block of sc_blockSize bytes\n\tremainder = (length - ((const uint8_t*)end - (const uint8_t*)message));\n\tmemcpy(buf, end, remainder);\n\tmemset(((uint8_t*)buf) + remainder, 0, sc_blockSize - remainder);\n\t((uint8_t*)buf)[sc_blockSize - 1] = (uint8_t)((uint32_t)remainder);\n\n\t// do some final mixing \n\tEnd(buf, h0, h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11);\n\t*hash1 = h0;\n\t*hash2 = h1;\n}\n\nvoid hash128(const wchar_t *const message, uint64_t *hash1, uint64_t *hash2)\n{\n\thash128(message, wcslen(message) * sizeof(wchar_t), hash1, hash2);\n}\n"
  },
  {
    "path": "DynamicAudioNormalizerVST/src/Spooky.h",
    "content": "// Spooky Hash\n// A 128-bit noncryptographic hash, for checksums and table lookup\n// By Bob Jenkins.  Public domain.\n//\n// This is a stripped-down version derived from the original source code. Find the original code at:\n// http://burtleburtle.net/bob/hash/spooky.html\n\n#include <cstdlib>\n#include <cstdint>\n\nvoid hash128(const void *const message, size_t length, uint64_t *hash1, uint64_t *hash2);\nvoid hash128(const wchar_t *const message, uint64_t *hash1, uint64_t *hash2);\n"
  },
  {
    "path": "DynamicAudioNormalizerWA5/DynamicAudioNormalizerWA5_VS2013.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"12.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"Debug|Win32\">\n      <Configuration>Debug</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|Win32\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|Win32\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <ProjectGuid>{4C09B776-E4AC-4459-9CEA-086011A0BA14}</ProjectGuid>\n    <Keyword>Win32Proj</Keyword>\n    <RootNamespace>DynamicAudioNormalizerWA5</RootNamespace>\n    <ProjectName>DynamicAudioNormalizerWA5</ProjectName>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v120_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <LinkIncremental>true</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <ClCompile>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERWA5_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\etc\\winamp_sdk\\include;$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\include</AdditionalIncludeDirectories>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n      <EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\lib\\$(Platform)\\shared</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERWA5_EXPORTS;MDYNAMICAUDIONORMALIZER_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\etc\\winamp_sdk\\include;$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\include</AdditionalIncludeDirectories>\n      <RuntimeLibrary Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">MultiThreaded</RuntimeLibrary>\n      <RuntimeLibrary Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">MultiThreaded</RuntimeLibrary>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\lib\\$(Platform)\\static</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERWA5_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\etc\\winamp_sdk\\include;$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\include</AdditionalIncludeDirectories>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\lib\\$(Platform)\\shared</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemGroup>\n    <ClCompile Include=\"DynamicAudioNormalizerWA5.cpp\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\DynamicAudioNormalizerAPI\\DynamicAudioNormalizerAPI_VS2013.vcxproj\">\n      <Project>{376386ee-8268-47e3-a335-7663716e4c60}</Project>\n    </ProjectReference>\n  </ItemGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerWA5/DynamicAudioNormalizerWA5_VS2013.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"DynamicAudioNormalizerWA5.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerWA5/DynamicAudioNormalizerWA5_VS2015.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"14.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"Debug|Win32\">\n      <Configuration>Debug</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|Win32\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|Win32\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <ProjectGuid>{4C09B776-E4AC-4459-9CEA-086011A0BA14}</ProjectGuid>\n    <Keyword>Win32Proj</Keyword>\n    <RootNamespace>DynamicAudioNormalizerWA5</RootNamespace>\n    <ProjectName>DynamicAudioNormalizerWA5</ProjectName>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v140_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <LinkIncremental>true</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <ClCompile>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERWA5_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\etc\\winamp_sdk\\include;$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\include</AdditionalIncludeDirectories>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n      <EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\lib\\$(Platform)\\shared</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERWA5_EXPORTS;MDYNAMICAUDIONORMALIZER_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\etc\\winamp_sdk\\include;$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\include</AdditionalIncludeDirectories>\n      <RuntimeLibrary Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">MultiThreaded</RuntimeLibrary>\n      <RuntimeLibrary Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">MultiThreaded</RuntimeLibrary>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\lib\\$(Platform)\\static</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERWA5_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\etc\\winamp_sdk\\include;$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\include</AdditionalIncludeDirectories>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\lib\\$(Platform)\\shared</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemGroup>\n    <ClCompile Include=\"DynamicAudioNormalizerWA5.cpp\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\DynamicAudioNormalizerAPI\\DynamicAudioNormalizerAPI_VS2015.vcxproj\">\n      <Project>{376386ee-8268-47e3-a335-7663716e4c60}</Project>\n      <Private>true</Private>\n      <ReferenceOutputAssembly>true</ReferenceOutputAssembly>\n      <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>\n      <LinkLibraryDependencies>true</LinkLibraryDependencies>\n      <UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>\n    </ProjectReference>\n  </ItemGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerWA5/DynamicAudioNormalizerWA5_VS2015.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"DynamicAudioNormalizerWA5.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerWA5/DynamicAudioNormalizerWA5_VS2017.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"14.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup Label=\"ProjectConfigurations\">\n    <ProjectConfiguration Include=\"Debug|Win32\">\n      <Configuration>Debug</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_DLL|Win32\">\n      <Configuration>Release_DLL</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n    <ProjectConfiguration Include=\"Release_Static|Win32\">\n      <Configuration>Release_Static</Configuration>\n      <Platform>Win32</Platform>\n    </ProjectConfiguration>\n  </ItemGroup>\n  <PropertyGroup Label=\"Globals\">\n    <ProjectGuid>{4C09B776-E4AC-4459-9CEA-086011A0BA14}</ProjectGuid>\n    <Keyword>Win32Proj</Keyword>\n    <RootNamespace>DynamicAudioNormalizerWA5</RootNamespace>\n    <ProjectName>DynamicAudioNormalizerWA5</ProjectName>\n    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>true</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\" Label=\"Configuration\">\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\n    <UseDebugLibraries>false</UseDebugLibraries>\n    <PlatformToolset>v141_xp</PlatformToolset>\n    <WholeProgramOptimization>true</WholeProgramOptimization>\n    <CharacterSet>Unicode</CharacterSet>\n  </PropertyGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n  <ImportGroup Label=\"ExtensionSettings\">\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <ImportGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\" Label=\"PropertySheets\">\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\n    <Import Project=\"..\\DynamicAudioNormalizer_VS2017.props\" />\n  </ImportGroup>\n  <PropertyGroup Label=\"UserMacros\" />\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <LinkIncremental>true</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <LinkIncremental>false</LinkIncremental>\n    <OutDir>$(SolutionDir)\\bin\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</OutDir>\n    <IntDir>$(SolutionDir)\\obj\\$(ProjectName)\\$(Platform)\\$(PlatformToolset)\\$(Configuration)\\</IntDir>\n  </PropertyGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\n    <ClCompile>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <WarningLevel>Level3</WarningLevel>\n      <Optimization>Disabled</Optimization>\n      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERWA5_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\etc\\winamp_sdk\\include;$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\include</AdditionalIncludeDirectories>\n      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\n      <EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>true</GenerateDebugInformation>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\lib\\$(Platform)\\shared</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_Static|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERWA5_EXPORTS;MDYNAMICAUDIONORMALIZER_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\etc\\winamp_sdk\\include;$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\include</AdditionalIncludeDirectories>\n      <RuntimeLibrary Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">MultiThreaded</RuntimeLibrary>\n      <RuntimeLibrary Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">MultiThreaded</RuntimeLibrary>\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\lib\\$(Platform)\\static</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n    <Manifest>\n      <AdditionalManifestFiles>$(SolutionDir)DynamicAudioNormalizerShared\\res\\compat.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>\n    </Manifest>\n  </ItemDefinitionGroup>\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release_DLL|Win32'\">\n    <ClCompile>\n      <WarningLevel>Level3</WarningLevel>\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\n      <Optimization>MaxSpeed</Optimization>\n      <FunctionLevelLinking>true</FunctionLevelLinking>\n      <IntrinsicFunctions>true</IntrinsicFunctions>\n      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;DYNAMICAUDIONORMALIZERWA5_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\n      <AdditionalIncludeDirectories>$(SolutionDir)\\DynamicAudioNormalizerAPI\\include;$(SolutionDir)\\DynamicAudioNormalizerShared\\include;$(SolutionDir)\\etc\\winamp_sdk\\include;$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\include</AdditionalIncludeDirectories>\n      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\n      <BufferSecurityCheck>false</BufferSecurityCheck>\n      <FloatingPointModel>Fast</FloatingPointModel>\n      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\n      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\n      <OmitFramePointers>true</OmitFramePointers>\n      <WholeProgramOptimization>true</WholeProgramOptimization>\n      <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\n    </ClCompile>\n    <Link>\n      <SubSystem>Windows</SubSystem>\n      <GenerateDebugInformation>false</GenerateDebugInformation>\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\n      <OptimizeReferences>true</OptimizeReferences>\n      <AdditionalLibraryDirectories>$(SolutionDir)\\..\\Prerequisites\\PthreadsW32\\lib\\$(Platform)\\shared</AdditionalLibraryDirectories>\n      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>\n      <ShowProgress>LinkVerboseLib</ShowProgress>\n    </Link>\n    <Manifest>\n      <AdditionalManifestFiles>$(SolutionDir)DynamicAudioNormalizerShared\\res\\compat.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>\n    </Manifest>\n  </ItemDefinitionGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\DynamicAudioNormalizerAPI\\DynamicAudioNormalizerAPI_VS2017.vcxproj\">\n      <Project>{376386ee-8268-47e3-a335-7663716e4c60}</Project>\n      <Private>true</Private>\n      <ReferenceOutputAssembly>true</ReferenceOutputAssembly>\n      <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>\n      <LinkLibraryDependencies>true</LinkLibraryDependencies>\n      <UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>\n    </ProjectReference>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\DynamicAudioNormalizerWA5.cpp\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"res\\DynamicAudioNormalizerWA5.rc\" />\n  </ItemGroup>\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n  <ImportGroup Label=\"ExtensionTargets\">\n  </ImportGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerWA5/DynamicAudioNormalizerWA5_VS2017.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"src\\DynamicAudioNormalizerWA5.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"res\\DynamicAudioNormalizerWA5.rc\">\n      <Filter>Resource Files</Filter>\n    </ResourceCompile>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizerWA5/res/DynamicAudioNormalizerWA5.rc",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Audio Processing Library\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// This library is free software; you can redistribute it and/or\n// modify it under the terms of the GNU Lesser General Public\n// License as published by the Free Software Foundation; either\n// version 2.1 of the License, or (at your option) any later version.\n//\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// Lesser General Public License for more details.\n//\n// You should have received a copy of the GNU Lesser General Public\n// License along with this library; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n//\n// http://www.gnu.org/licenses/lgpl-2.1.txt\n//////////////////////////////////////////////////////////////////////////////////\n\n#include \"WinResrc.h\" //\"afxres.h\"\n\n#define INC_DYNAUDNORM_VERSION_INTERNAL 0x22b4f8a9\n#include \"../DynamicAudioNormalizerShared/res/version.inc\"\n\n//////////////////////////////////////////////////////////////////////////////////\n// Neutral resources\n//////////////////////////////////////////////////////////////////////////////////\n\n#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)\n#ifdef _WIN32\nLANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL\n#pragma code_page(1252)\n#endif //_WIN32\n\n//////////////////////////////////////////////////////////////////////////////////\n// Version\n//////////////////////////////////////////////////////////////////////////////////\n\nVS_VERSION_INFO VERSIONINFO\n FILEVERSION    VER_DYNAUDNORM_MAJOR,VER_DYNAUDNORM_MINOR_HI,VER_DYNAUDNORM_MINOR_LO,VER_DYNAUDNORM_PATCH\n PRODUCTVERSION VER_DYNAUDNORM_MAJOR,VER_DYNAUDNORM_MINOR_HI,VER_DYNAUDNORM_MINOR_LO,VER_DYNAUDNORM_PATCH\n FILEFLAGSMASK 0x17L\n#ifdef _DEBUG\n FILEFLAGS 0x3L\n#else\n FILEFLAGS 0x2L\n#endif\n FILEOS 0x40004L\n FILETYPE 0x2L\n FILESUBTYPE 0x0L\nBEGIN\n    BLOCK \"StringFileInfo\"\n    BEGIN\n        BLOCK \"000004b0\"\n        BEGIN\n            VALUE \"Comments\", \"This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License <http://www.gnu.org/>.\"\n            VALUE \"CompanyName\", \"LoRd_MuldeR <mulder2@gmx.de>\"\n            VALUE \"FileDescription\", \"DynamicAudioNormalizer Winamp Plugin\"\n            VALUE \"FileVersion\", VER_DYNAUDNORM_STR\n            VALUE \"InternalName\", \"DynamicAudioNormalizerWA5\"\n            VALUE \"LegalCopyright\", \"Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>\"\n            VALUE \"LegalTrademarks\", \"This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License <http://www.gnu.org/>\"\n            VALUE \"OriginalFilename\", \"DynamicAudioNormalizerWA5.dll\"\n            VALUE \"ProductName\", \"DynamicAudioNormalizer\"\n            VALUE \"ProductVersion\", VER_DYNAUDNORM_STR\n        END\n    END\n    BLOCK \"VarFileInfo\"\n    BEGIN\n        VALUE \"Translation\", 0x0, 1200\n    END\nEND\n\n#endif    // Neutral resources\n"
  },
  {
    "path": "DynamicAudioNormalizerWA5/src/DynamicAudioNormalizerWA5.cpp",
    "content": "//////////////////////////////////////////////////////////////////////////////////\n// Dynamic Audio Normalizer - Winamp DSP Wrapper\n// Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n// http://opensource.org/licenses/MIT\n//////////////////////////////////////////////////////////////////////////////////\n\n//Stdlib\n#include <cstdlib>\n#include <cstdio>\n#include <stdint.h>\n#include <algorithm>\n\n//Win32\n#define NOMINMAX 1\n#define WIN32_LEAN_AND_MEAN 1\n#include <Windows.h>\n\n//Winamp\n#include <winamp_dsp.h>\n#include <winamp_ipc.h>\n\n//Internal\n#include <Common.h>\n#include <Threads.h>\n\n//Dynamic Audio Normalizer API\n#include <DynamicAudioNormalizer.h>\n\n//DLL exports\n#define DLL_EXPORT __declspec(dllexport)\n\n//Reg key\nstatic const wchar_t *REGISTRY_BASEPATH = L\"Software\\\\MuldeR\\\\DynAudNorm\\\\WA5\";\nstatic const wchar_t *REGISTRY_VERSION  = L\"Version\";\nstatic const wchar_t *REGISTRY_FRAMELEN = L\"FrameLenMsec\";\nstatic const wchar_t *REGISTRY_FLTRSIZE = L\"FilterSize\";\n\n//Defaults\nstatic const DWORD FRAMELEN_DEFAULT = 500;\nstatic const DWORD FLTRSIZE_DEFAULT = 31;\n\n//Critical Section\nstatic char g_loggingBuffer[1024];\nstatic MY_CRITSEC_INIT(g_loggingMutex);\n\n//Forward declarations\nstatic void config(struct winampDSPModule*);\nstatic int init(struct winampDSPModule*);\nstatic void quit(struct winampDSPModule*);\nstatic int modify_samples(struct winampDSPModule*, short int*, int, int, int, int);\nstatic winampDSPModule *getModule(int);\nstatic int sf(int);\nstatic bool showAboutScreen(const uint32_t&, const uint32_t&, const uint32_t&, const char *const, const char *const, const char *const, const char *const, const bool&, const bool &config);\n\n//Const\nstatic const size_t MAX_CHANNELS = 12;\n\n///////////////////////////////////////////////////////////////////////////////\n// Global Data\n///////////////////////////////////////////////////////////////////////////////\n\nstatic char g_description[256] = { '\\0' };\n\nstatic winampDSPHeader g_header =\n{\n\tDSP_HDRVER + 1,\n\t\"Dynamic Audio Normalizer [\" __DATE__ \"]\",\n\tgetModule,\n\tsf\n};\n\nstatic winampDSPModule g_module =\n{\n\tg_description,\n\tNULL,\t// hwndParent\n\tNULL,\t// hDllInstance\n\tconfig,\n\tinit,\n\tmodify_samples,\n\tquit\n};\n\nstatic struct\n{\n\tuint32_t sampleRate;\n\tuint32_t bitsPerSample;\n\tuint32_t channels;\n}\ng_properties =\n{\n\t44100, 16, 2\n};\n\nstatic volatile WNDPROC g_oldWndProc = NULL;\nstatic volatile LONG g_forceReset = 0;\nstatic volatile DWORD g_lastResetTick = 0;\n\n///////////////////////////////////////////////////////////////////////////////\n// Helper functions\n///////////////////////////////////////////////////////////////////////////////\n\nstatic void outputMessage(const char *const format, ...)\n{\n\tMY_CRITSEC_ENTER(g_loggingMutex);\n\n\tva_list argList;\n\tva_start(argList, format);\n\tvsnprintf_s(g_loggingBuffer, 1024, _TRUNCATE, format, argList);\n\tva_end(argList);\n\tOutputDebugStringA(g_loggingBuffer);\n\n\tMY_CRITSEC_LEAVE(g_loggingMutex);\n}\n\nstatic void logFunction(const int logLevel, const char *const message)\n{\n\tswitch (logLevel) \n\t{\n\tcase MDynamicAudioNormalizer::LOG_LEVEL_DBG:\n\t\toutputMessage(\"[DynAudNorm_WA5] NFO: %s\\n\", message);\n\t\tbreak;\n\tcase MDynamicAudioNormalizer::LOG_LEVEL_WRN:\n\t\toutputMessage(\"[DynAudNorm_WA5] WRN: %s\\n\", message);\n\t\tbreak;\n\tcase MDynamicAudioNormalizer::LOG_LEVEL_ERR:\n\t\toutputMessage(\"[DynAudNorm_WA5] ERR: %s\\n\", message);\n\t\tbreak;\n\tdefault:\n\t\toutputMessage(\"[DynAudNorm_WA5] DBG: %s\\n\", message);\n\t\tbreak;\n\t}\n}\n\nstatic void showErrorMsg(const char *const text)\n{\n\tMessageBoxA(NULL, text, \"Dynamic Audio Normalizer\", MB_ICONSTOP | MB_TOPMOST | MB_TASKMODAL);\n}\n\nstatic DWORD regValueGet(const wchar_t *const name)\n{\n\tDWORD result = 0; HKEY hKey = NULL;\n\tif(RegCreateKeyExW(HKEY_CURRENT_USER, REGISTRY_BASEPATH, 0, NULL, 0, KEY_READ, NULL, &hKey, NULL) == ERROR_SUCCESS)\n\t{\n\t\tDWORD type = 0, value = 0, size = sizeof(DWORD);\n\t\tif(RegQueryValueExW(hKey, name, 0, &type, ((LPBYTE) &value), &size) == ERROR_SUCCESS)\n\t\t{\n\t\t\tif((type == REG_DWORD) && (size == sizeof(DWORD)))\n\t\t\t{\n\t\t\t\tresult = value;\n\t\t\t}\n\t\t}\n\t\tRegCloseKey(hKey);\n\t}\n\treturn result;\n}\n\nstatic bool regValueSet(const wchar_t *const name, const DWORD &value)\n{\n\tbool result = false; HKEY hKey = NULL;\n\tif(RegCreateKeyExW(HKEY_CURRENT_USER, REGISTRY_BASEPATH, 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS)\n\t{\n\t\tif(RegSetValueExW(hKey, name, 0, REG_DWORD, ((LPBYTE) &value), sizeof(DWORD)) == ERROR_SUCCESS)\n\t\t{\n\t\t\tresult = true;\n\t\t}\n\t\tRegCloseKey(hKey);\n\t}\n\treturn result;\n}\n\nstatic double *allocBuffer(size_t size)\n{\n\tdouble *buffer = NULL;\n\ttry\n\t{\n\t\tbuffer = new double[size];\n\t}\n\tcatch(...)\n\t{\n\t\toutputMessage(\"[DynAudNorm_WA5] ERR: Allocation of size %u failed!\", static_cast<unsigned int>(sizeof(double) * size));\n\t\tshowErrorMsg(\"Memory allocation has failed: Out of memory!\");\n\t\t_exit(0xC0000017);\n\t}\n\treturn buffer;\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Internal Functions\n///////////////////////////////////////////////////////////////////////////////\n\nstatic MDynamicAudioNormalizer *g_instance = NULL;\nstatic size_t g_sampleBufferSize = 0;\nstatic double *g_sampleBuffer[MAX_CHANNELS];\n\nstatic void updateBufferSize(const int &numsamples)\n{\n\tif(size_t(numsamples) > g_sampleBufferSize)\n\t{\n\t\tif(g_sampleBufferSize > 0)\n\t\t{\n\t\t\tfor(int c = 0; c < MAX_CHANNELS; c++)\n\t\t\t{\n\t\t\t\tdelete [] (g_sampleBuffer[c]);\n\t\t\t\tg_sampleBuffer[c] = NULL;\n\t\t\t}\n\t\t}\n\t\tfor(int c = 0; c < MAX_CHANNELS; c++)\n\t\t{\n\t\t\tg_sampleBuffer[c] = allocBuffer(numsamples);\n\t\t}\n\t\tg_sampleBufferSize = numsamples;\n\t}\n}\n\nstatic void deinterleave(const short int *const input, const int &numsamples, const int &bps, const int &nch)\n{\n\tupdateBufferSize(numsamples);\n\n\tif(bps == 16)\n\t{\n\t\tconst short int *ptr = input;\n\t\tfor(int i = 0; i < numsamples; i++)\n\t\t{\n\t\t\tfor(int c = 0; c < nch; c++)\n\t\t\t{\n\t\t\t\tg_sampleBuffer[c][i] = std::min(1.0, std::max(-1.0, (double(*(ptr++)) / double(SHRT_MAX))));\n\t\t\t}\n\t\t}\n\t}\n\telse if(bps == 8)\n\t{\n\t\tconst int8_t *ptr = reinterpret_cast<const int8_t*>(input);\n\t\tfor(int i = 0; i < numsamples; i++)\n\t\t{\n\t\t\tfor(int c = 0; c < nch; c++)\n\t\t\t{\n\t\t\t\tg_sampleBuffer[c][i] = std::min(1.0, std::max(-1.0, (double(*(ptr++)) / double(INT8_MAX))));\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tshowErrorMsg(\"Unsupported bit-depth detected!\");\n\t}\n}\n\nstatic void interleave(short int *const output, const int &numsamples, const int &bps, const int &nch)\n{\n\tupdateBufferSize(numsamples);\n\n\tif(bps == 16)\n\t{\n\t\tshort int *ptr = output;\n\t\tfor(int i = 0; i < numsamples; i++)\n\t\t{\n\t\t\tfor(int c = 0; c < nch; c++)\n\t\t\t{\n\t\t\t\t*(ptr++) = static_cast<short int>(std::max(double(SHRT_MIN), std::min(double(SHRT_MAX), round(g_sampleBuffer[c][i] * double(SHRT_MAX)))));\n\t\t\t}\n\t\t}\n\t}\n\telse if(bps == 8)\n\t{\n\t\tint8_t *ptr = reinterpret_cast<int8_t*>(output);\n\t\tfor(int i = 0; i < numsamples; i++)\n\t\t{\n\t\t\tfor(int c = 0; c < nch; c++)\n\t\t\t{\n\t\t\t\t*(ptr++) = static_cast<int8_t>(std::max(double(INT8_MIN), std::min(double(INT8_MAX), round(g_sampleBuffer[c][i] * double(INT8_MAX)))));\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tshowErrorMsg(\"Unsupported bit-depth detected!\");\n\t}\n}\n\nstatic bool createNewInstance(const uint32_t sampleRate, const uint32_t channelCount)\n{\n\tif(g_instance)\n\t{\n\t\tdelete g_instance;\n\t\tg_instance = NULL;\n\t}\n\n\tconst DWORD optionFrameLen = regValueGet(REGISTRY_FRAMELEN);\n\tconst DWORD optionFltrSize = regValueGet(REGISTRY_FLTRSIZE);\n\n\ttry\n\t{\n\t\tg_instance = new MDynamicAudioNormalizer\n\t\t(\n\t\t\tchannelCount,\n\t\t\tsampleRate,\n\t\t\toptionFrameLen ? optionFrameLen : FRAMELEN_DEFAULT,\n\t\t\toptionFltrSize ? optionFltrSize : FLTRSIZE_DEFAULT\n\t\t);\n\t}\n\tcatch(...)\n\t{\n\t\tshowErrorMsg(\"Failed to create Dynamic Audio Normalizer instance!\");\n\t\treturn false;\n\t}\n\n\tif(!g_instance->initialize())\n\t{\n\t\tshowErrorMsg(\"Dynamic Audio Normalizer initialization has failed!\");\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\nstatic bool detectWinampVersion(const HWND &hwndParent)\n{\n\tunsigned long winampVersion      = 0;\n\tunsigned long winampVersionMajor = 0;\n\tunsigned long winampVersionMinor = 0;\n\n\tif(SendMessageTimeout(hwndParent, WM_WA_IPC, 0, IPC_GETVERSION, SMTO_ABORTIFHUNG, 5000, &winampVersion))\n\t{\n\t\tif((winampVersion >= 0x5000) && (winampVersion <= 0xFFFFF))\n\t\t{\n\t\t\twinampVersionMajor = (winampVersion >> 0xC);\n\t\t\twinampVersionMinor = (winampVersion & 0xFF);\n\t\t}\n\t}\n\telse\n\t{\n\t\twinampVersion = 0xFFFFFFFF;\n\t}\n\n\toutputMessage(\"[DynAudNorm_WA5] Winamp version is: 0x%X (v%X.%02X)\", winampVersion, winampVersionMajor, winampVersionMinor);\n\n\tif(winampVersionMajor < 1)\n\t{\n\t\tshowErrorMsg(\"Failed to detect Winamp version. Please use Winamp 5.0 or newer!\");\n\t\treturn false;\n\t}\n\t\n\tif(winampVersionMajor < 5)\n\t{\n\t\tshowErrorMsg(\"Your Winamp version is too old. Please use Winamp 5.0 or newer!\");\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\nstatic LRESULT CALLBACK winampWindowHook(const HWND hwnd, const UINT uMsg, const WPARAM wParam, const LPARAM lParam)\n{\n\tif ((lParam == IPC_CB_MISC) && ((wParam == IPC_CB_MISC_STATUS) || (wParam == IPC_CB_MISC_TITLE)))\n\t{\n\t\tInterlockedIncrement(&g_forceReset);\n\t}\n\n\tif (g_oldWndProc)\n\t{\n\t\treturn g_oldWndProc(hwnd, uMsg, wParam, lParam);\n\t}\n\n\treturn 0L;\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Public Functions\n///////////////////////////////////////////////////////////////////////////////\n\nstatic void config(struct winampDSPModule *this_mod)\n{\n\toutputMessage(\"[DynAudNorm_WA5] WinampDSP::config(%p)\", this_mod);\n\n\tuint32_t major, minor, patch;\n\tMDynamicAudioNormalizer::getVersionInfo(major, minor, patch);\n\n\tconst char *date, *time, *compiler, *arch; bool debug;\n\tMDynamicAudioNormalizer::getBuildInfo(&date, &time, &compiler, &arch, debug);\n\n\tshowAboutScreen(major, minor, patch, date, time, compiler, arch, debug, true);\n}\n\nstatic int init(struct winampDSPModule *this_mod)\n{\n\toutputMessage(\"[DynAudNorm_WA5] WinampDSP::init(%p)\", this_mod);\n\tdetectWinampVersion(this_mod->hwndParent);\n\n\tif(g_sampleBufferSize == 0)\n\t{\n\t\tfor(int c = 0; c < MAX_CHANNELS; c++)\n\t\t{\n\t\t\tg_sampleBuffer[c] = allocBuffer(1024);\n\t\t}\n\t\tg_sampleBufferSize = 1024;\n\t}\n\n\tif(!createNewInstance(g_properties.sampleRate, g_properties.channels))\n\t{\n\t\treturn 1;\n\t}\n\n\tif (!(g_oldWndProc = (WNDPROC)SetWindowLong(this_mod->hwndParent, GWL_WNDPROC, (LONG_PTR)winampWindowHook)))\n\t{\n\t\toutputMessage(\"[DynAudNorm_WA5] WARNING: Failed to hook Winamp window!\");\n\t}\n\n\treturn 0;\n}\n\nstatic void quit(struct winampDSPModule *this_mod)\n{\n\toutputMessage(\"[DynAudNorm_WA5] WinampDSP::quit(%p)\", this_mod);\n\n\tif (g_oldWndProc)\n\t{\n\t\tif (SetWindowLong(this_mod->hwndParent, GWL_WNDPROC, (LONG_PTR)g_oldWndProc))\n\t\t{\n\t\t\tg_oldWndProc = NULL;\n\t\t}\n\t}\n\n\tif(g_sampleBufferSize > 0)\n\t{\n\t\tfor(int c = 0; c < MAX_CHANNELS; c++)\n\t\t{\n\t\t\tdelete [] (g_sampleBuffer[c]);\n\t\t\tg_sampleBuffer[c] = NULL;\n\t\t}\n\t\tg_sampleBufferSize = 0;\n\t}\n}\n\nstatic int modify_samples(struct winampDSPModule *this_mod, short int *samples, int numsamples, int bps, int nch, int srate)\n{\n\tif(numsamples < 1)\n\t{\n\t\toutputMessage(\"[DynAudNorm_WA5] Sample count is zero or negative -> nothing to do!\");\n\t\treturn 0;\n\t}\n\n\tif(nch > MAX_CHANNELS)\n\t{\n\t\tshowErrorMsg(\"Maximum channel count has been exceeded!\");\n\t\treturn 0;\n\t}\n\n\tif((!g_instance) || (g_properties.bitsPerSample != bps) || (g_properties.channels != nch) || (g_properties.sampleRate != srate))\n\t{\n\t\toutputMessage(\"[DynAudNorm_WA5] WinampDSP::modify_samples(mod=%p, num=%d, bps=%d, nch=%d, srate=%d)\", this_mod, numsamples, bps, nch, srate);\n\n\t\tg_properties.bitsPerSample = bps;\n\t\tg_properties.channels = nch;\n\t\tg_properties.sampleRate = srate;\n\n\t\tif(!createNewInstance(g_properties.sampleRate, g_properties.channels))\n\t\t{\n\t\t\treturn 0; /*creating instance failed!*/\n\t\t}\n\t}\n\telse if (InterlockedExchange(&g_forceReset, 0L) > 0L)\n\t{\n\t\tconst DWORD tickCount = GetTickCount();\n\t\tif ((tickCount < g_lastResetTick) || ((tickCount - g_lastResetTick) > 250L))\n\t\t{\n\t\t\tif (g_lastResetTick)\n\t\t\t{\n\t\t\t\toutputMessage(\"[DynAudNorm_WA5] Reset has been triggered!\");\n\t\t\t\tg_instance->reset();\n\t\t\t}\n\t\t\tg_lastResetTick = tickCount;\n\t\t}\n\t}\n\n\tdeinterleave(samples, numsamples, bps, nch);\n\n\tint64_t outputSize;\n\tg_instance->processInplace(g_sampleBuffer, numsamples, outputSize);\n\n\tinterleave(samples, static_cast<int>(outputSize), bps, nch);\n\treturn static_cast<int>(outputSize);\n}\n\n///////////////////////////////////////////////////////////////////////////////\n// Winamp DSP API\n///////////////////////////////////////////////////////////////////////////////\n\nstatic int8_t g_initialized = -1;\nstatic MY_CRITSEC_INIT(g_createEffMutex);\n\nstatic void appendStr(wchar_t *buffer, const size_t &size, const wchar_t *const text, ...)\n{\n\twchar_t temp[128];\n\tva_list argList;\n\tva_start(argList, text);\n\t_vsnwprintf_s(temp, 128, _TRUNCATE, text, argList);\n\tva_end(argList);\n\twcsncat_s(buffer, size, temp, _TRUNCATE);\n}\n\nstatic bool showAboutScreen(const uint32_t &major, const uint32_t &minor, const uint32_t &patch, const char *const date, const char *const time, const char *const compiler, const char *const arch, const bool &debug, const bool &config)\n{\n\twchar_t text[1024] = { '\\0' };\n\tappendStr(text, 1024, L\"Dynamic Audio Normalizer, Winamp Wrapper, Version %u.%02u-%u, %s\\n\", major, minor, patch, (debug ? L\"DEBGU\" : L\"Release\"));\n\tappendStr(text, 1024, L\"Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\\n\");\n\tappendStr(text, 1024, L\"Built on %S at %S with %S for %S.\\n\\n\", date, time, compiler, arch);\n\tappendStr(text, 1024, L\"This library is free software; you can redistribute it and/or\\n\");\n\tappendStr(text, 1024, L\"modify it under the terms of the GNU Lesser General Public\\n\");\n\tappendStr(text, 1024, L\"License as published by the Free Software Foundation; either\\n\");\n\tappendStr(text, 1024, L\"version 2.1 of the License, or (at your option) any later version.\\n\\n\");\n\tappendStr(text, 1024, L\"This library is distributed in the hope that it will be useful,\\n\");\n\tappendStr(text, 1024, L\"but WITHOUT ANY WARRANTY; without even the implied warranty of\\n\");\n\tappendStr(text, 1024, L\"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\\n\");\n\tappendStr(text, 1024, L\"Lesser General Public License for more details.\\n\");\n\n\tif(config)\n\t{\n\t\tMessageBoxW(NULL, text, L\"Dynamic Audio Normalizer\", MB_TOPMOST | MB_TASKMODAL | MB_OK);\n\t\treturn true;\n\t}\n\telse\n\t{\n\t\tappendStr(text, 1024, L\"\\nPlease click 'OK' if you agree to the above notice or 'Cancel' otherwise...\\n\");\n\t\tconst int ret = MessageBoxW(NULL, text, L\"Dynamic Audio Normalizer\", MB_TOPMOST | MB_TASKMODAL | MB_OKCANCEL | MB_DEFBUTTON2);\n\t\treturn (ret == IDOK);\n\t}\n}\n\nstatic bool initializeCoreLibrary(void)\n{\n\tMDynamicAudioNormalizer::setLogFunction(logFunction);\n\n\tuint32_t major, minor, patch;\n\tMDynamicAudioNormalizer::getVersionInfo(major, minor, patch);\n\n\toutputMessage(\"[DynAudNorm_WA5] Dynamic Audio Normalizer Winamp-Wrapper (v%u.%02u-%u)\", major, minor, patch);\n\t_snprintf_s(g_description, 256, _TRUNCATE, \"Dynamic Audio Normalizer v%u.%02u-%u [by LoRd_MuldeR]\", major, minor, patch);\n\n\tconst DWORD version = (1000u * major) + (10u * minor) + patch;\n\tif(regValueGet(REGISTRY_VERSION) != version)\n\t{\n\t\tconst char *date, *time, *compiler, *arch; bool debug;\n\t\tMDynamicAudioNormalizer::getBuildInfo(&date, &time, &compiler, &arch, debug);\n\n\t\tif(!showAboutScreen(major, minor, patch, date, time, compiler, arch, debug, false))\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\tregValueSet(REGISTRY_VERSION, version);\n\t\tregValueSet(REGISTRY_FRAMELEN, FRAMELEN_DEFAULT);\n\t\tregValueSet(REGISTRY_FLTRSIZE, FLTRSIZE_DEFAULT);\n\t}\n\n\treturn true;\n}\n\nstatic winampDSPModule *getModule(int which)\n{\n\toutputMessage(\"[DynAudNorm_WA5] WinampDSP::getModule(%d)\", which);\n\n\twinampDSPModule *module = NULL;\n\tMY_CRITSEC_ENTER(g_createEffMutex);\n\n\tif(which == 0)\n\t{\n\t\tif(g_initialized < 0)\n\t\t{\n\t\t\tg_initialized = initializeCoreLibrary() ? 1 : 0;\n\t\t}\n\t\tif(g_initialized > 0)\n\t\t{\n\t\t\tmodule = &g_module;\n\t\t}\n\t}\n\n\tMY_CRITSEC_LEAVE(g_createEffMutex);\n\treturn module;\n}\n\nstatic int sf(int v)\t/*Note: The \"sf\" function was copied 1:1 from the example code, I have NO clue what it does!*/\n{\n\tint res;\n\tres = v * (unsigned long)1103515245;\n\tres += (unsigned long)13293;\n\tres &= (unsigned long)0x7FFFFFFF;\n\tres ^= v;\n\treturn res;\n}\n\nextern \"C\" DLL_EXPORT winampDSPHeader *winampDSPGetHeader2()\n{\n\toutputMessage(\"[DynAudNorm_WA5] WinampDSP::winampDSPGetHeader2()\");\n\treturn &g_header;\n}\n"
  },
  {
    "path": "DynamicAudioNormalizer_VS2013.sln",
    "content": "﻿\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2013\nVisualStudioVersion = 12.0.30723.0\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"DynamicAudioNormalizerCLI\", \"DynamicAudioNormalizerCLI\\DynamicAudioNormalizerCLI_VS2013.vcxproj\", \"{5B755CC3-EC17-490F-AE82-CBC16E2EB143}\"\nEndProject\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"DynamicAudioNormalizerAPI\", \"DynamicAudioNormalizerAPI\\DynamicAudioNormalizerAPI_VS2013.vcxproj\", \"{376386EE-8268-47E3-A335-7663716E4C60}\"\nEndProject\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"DynamicAudioNormalizerGUI\", \"DynamicAudioNormalizerGUI\\DynamicAudioNormalizerGUI_VS2013.vcxproj\", \"{131C921A-7144-4C1D-9C97-57C43FA83DFE}\"\nEndProject\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"DynamicAudioNormalizerVST\", \"DynamicAudioNormalizerVST\\DynamicAudioNormalizerVST_VS2013.vcxproj\", \"{A30375E8-AEF7-4531-B372-02328E0B9D43}\"\nEndProject\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"DynamicAudioNormalizerWA5\", \"DynamicAudioNormalizerWA5\\DynamicAudioNormalizerWA5_VS2013.vcxproj\", \"{4C09B776-E4AC-4459-9CEA-086011A0BA14}\"\nEndProject\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"DynamicAudioNormalizerNET\", \"DynamicAudioNormalizerNET\\DynamicAudioNormalizerNET_VS2013.vcxproj\", \"{E1794071-AB51-45C7-B215-028F3DAA2219}\"\nEndProject\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"DynamicAudioNormalizerPYD\", \"DynamicAudioNormalizerPYD\\DynamicAudioNormalizerPYD_VS2013.vcxproj\", \"{5ACB9827-9D3A-4C59-A948-8505D1544A8E}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Win32 = Debug|Win32\n\t\tDebug|x64 = Debug|x64\n\t\tRelease_DLL|Win32 = Release_DLL|Win32\n\t\tRelease_DLL|x64 = Release_DLL|x64\n\t\tRelease_Static|Win32 = Release_Static|Win32\n\t\tRelease_Static|x64 = Release_Static|x64\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{5B755CC3-EC17-490F-AE82-CBC16E2EB143}.Debug|Win32.ActiveCfg = Debug|Win32\n\t\t{5B755CC3-EC17-490F-AE82-CBC16E2EB143}.Debug|Win32.Build.0 = Debug|Win32\n\t\t{5B755CC3-EC17-490F-AE82-CBC16E2EB143}.Debug|x64.ActiveCfg = Debug|Win32\n\t\t{5B755CC3-EC17-490F-AE82-CBC16E2EB143}.Release_DLL|Win32.ActiveCfg = Release_DLL|Win32\n\t\t{5B755CC3-EC17-490F-AE82-CBC16E2EB143}.Release_DLL|Win32.Build.0 = Release_DLL|Win32\n\t\t{5B755CC3-EC17-490F-AE82-CBC16E2EB143}.Release_DLL|x64.ActiveCfg = Release_DLL|Win32\n\t\t{5B755CC3-EC17-490F-AE82-CBC16E2EB143}.Release_Static|Win32.ActiveCfg = Release_Static|Win32\n\t\t{5B755CC3-EC17-490F-AE82-CBC16E2EB143}.Release_Static|Win32.Build.0 = Release_Static|Win32\n\t\t{5B755CC3-EC17-490F-AE82-CBC16E2EB143}.Release_Static|x64.ActiveCfg = Release_Static|Win32\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Debug|Win32.ActiveCfg = Debug|Win32\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Debug|Win32.Build.0 = Debug|Win32\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Debug|x64.ActiveCfg = Debug|x64\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Debug|x64.Build.0 = Debug|x64\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Release_DLL|Win32.ActiveCfg = Release_DLL|Win32\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Release_DLL|Win32.Build.0 = Release_DLL|Win32\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Release_DLL|x64.ActiveCfg = Release_DLL|x64\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Release_DLL|x64.Build.0 = Release_DLL|x64\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Release_Static|Win32.ActiveCfg = Release_Static|Win32\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Release_Static|Win32.Build.0 = Release_Static|Win32\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Release_Static|x64.ActiveCfg = Release_Static|x64\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Release_Static|x64.Build.0 = Release_Static|x64\n\t\t{131C921A-7144-4C1D-9C97-57C43FA83DFE}.Debug|Win32.ActiveCfg = Debug|Win32\n\t\t{131C921A-7144-4C1D-9C97-57C43FA83DFE}.Debug|Win32.Build.0 = Debug|Win32\n\t\t{131C921A-7144-4C1D-9C97-57C43FA83DFE}.Debug|x64.ActiveCfg = Debug|Win32\n\t\t{131C921A-7144-4C1D-9C97-57C43FA83DFE}.Release_DLL|Win32.ActiveCfg = Release_DLL|Win32\n\t\t{131C921A-7144-4C1D-9C97-57C43FA83DFE}.Release_DLL|Win32.Build.0 = Release_DLL|Win32\n\t\t{131C921A-7144-4C1D-9C97-57C43FA83DFE}.Release_DLL|x64.ActiveCfg = Release_DLL|Win32\n\t\t{131C921A-7144-4C1D-9C97-57C43FA83DFE}.Release_Static|Win32.ActiveCfg = Release_Static|Win32\n\t\t{131C921A-7144-4C1D-9C97-57C43FA83DFE}.Release_Static|Win32.Build.0 = Release_Static|Win32\n\t\t{131C921A-7144-4C1D-9C97-57C43FA83DFE}.Release_Static|x64.ActiveCfg = Release_Static|Win32\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Debug|Win32.ActiveCfg = Debug|Win32\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Debug|Win32.Build.0 = Debug|Win32\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Debug|x64.ActiveCfg = Debug|x64\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Debug|x64.Build.0 = Debug|x64\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Release_DLL|Win32.ActiveCfg = Release_DLL|Win32\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Release_DLL|Win32.Build.0 = Release_DLL|Win32\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Release_DLL|x64.ActiveCfg = Release_DLL|x64\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Release_DLL|x64.Build.0 = Release_DLL|x64\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Release_Static|Win32.ActiveCfg = Release_Static|Win32\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Release_Static|Win32.Build.0 = Release_Static|Win32\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Release_Static|x64.ActiveCfg = Release_Static|x64\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Release_Static|x64.Build.0 = Release_Static|x64\n\t\t{4C09B776-E4AC-4459-9CEA-086011A0BA14}.Debug|Win32.ActiveCfg = Debug|Win32\n\t\t{4C09B776-E4AC-4459-9CEA-086011A0BA14}.Debug|Win32.Build.0 = Debug|Win32\n\t\t{4C09B776-E4AC-4459-9CEA-086011A0BA14}.Debug|x64.ActiveCfg = Debug|Win32\n\t\t{4C09B776-E4AC-4459-9CEA-086011A0BA14}.Release_DLL|Win32.ActiveCfg = Release_DLL|Win32\n\t\t{4C09B776-E4AC-4459-9CEA-086011A0BA14}.Release_DLL|Win32.Build.0 = Release_DLL|Win32\n\t\t{4C09B776-E4AC-4459-9CEA-086011A0BA14}.Release_DLL|x64.ActiveCfg = Release_DLL|Win32\n\t\t{4C09B776-E4AC-4459-9CEA-086011A0BA14}.Release_Static|Win32.ActiveCfg = Release_Static|Win32\n\t\t{4C09B776-E4AC-4459-9CEA-086011A0BA14}.Release_Static|Win32.Build.0 = Release_Static|Win32\n\t\t{4C09B776-E4AC-4459-9CEA-086011A0BA14}.Release_Static|x64.ActiveCfg = Release_Static|Win32\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Debug|Win32.ActiveCfg = Debug|Win32\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Debug|Win32.Build.0 = Debug|Win32\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Debug|x64.ActiveCfg = Debug|x64\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Debug|x64.Build.0 = Debug|x64\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Release_DLL|Win32.ActiveCfg = Release_DLL|Win32\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Release_DLL|Win32.Build.0 = Release_DLL|Win32\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Release_DLL|x64.ActiveCfg = Release_DLL|x64\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Release_DLL|x64.Build.0 = Release_DLL|x64\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Release_Static|Win32.ActiveCfg = Release_Static|Win32\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Release_Static|x64.ActiveCfg = Release_Static|x64\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Debug|Win32.ActiveCfg = Debug|Win32\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Debug|Win32.Build.0 = Debug|Win32\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Debug|x64.ActiveCfg = Debug|x64\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Debug|x64.Build.0 = Debug|x64\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Release_DLL|Win32.ActiveCfg = Release_DLL|Win32\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Release_DLL|Win32.Build.0 = Release_DLL|Win32\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Release_DLL|x64.ActiveCfg = Release_DLL|x64\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Release_DLL|x64.Build.0 = Release_DLL|x64\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Release_Static|Win32.ActiveCfg = Release_Static|Win32\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Release_Static|Win32.Build.0 = Release_Static|Win32\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Release_Static|x64.ActiveCfg = Release_Static|x64\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Release_Static|x64.Build.0 = Release_Static|x64\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n"
  },
  {
    "path": "DynamicAudioNormalizer_VS2015.sln",
    "content": "﻿\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.25420.1\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"DynamicAudioNormalizerCLI\", \"DynamicAudioNormalizerCLI\\DynamicAudioNormalizerCLI_VS2015.vcxproj\", \"{5B755CC3-EC17-490F-AE82-CBC16E2EB143}\"\nEndProject\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"DynamicAudioNormalizerAPI\", \"DynamicAudioNormalizerAPI\\DynamicAudioNormalizerAPI_VS2015.vcxproj\", \"{376386EE-8268-47E3-A335-7663716E4C60}\"\nEndProject\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"DynamicAudioNormalizerGUI\", \"DynamicAudioNormalizerGUI\\DynamicAudioNormalizerGUI_VS2015.vcxproj\", \"{131C921A-7144-4C1D-9C97-57C43FA83DFE}\"\nEndProject\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"DynamicAudioNormalizerVST\", \"DynamicAudioNormalizerVST\\DynamicAudioNormalizerVST_VS2015.vcxproj\", \"{A30375E8-AEF7-4531-B372-02328E0B9D43}\"\nEndProject\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"DynamicAudioNormalizerWA5\", \"DynamicAudioNormalizerWA5\\DynamicAudioNormalizerWA5_VS2015.vcxproj\", \"{4C09B776-E4AC-4459-9CEA-086011A0BA14}\"\nEndProject\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"DynamicAudioNormalizerNET\", \"DynamicAudioNormalizerNET\\DynamicAudioNormalizerNET_VS2015.vcxproj\", \"{E1794071-AB51-45C7-B215-028F3DAA2219}\"\nEndProject\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"DynamicAudioNormalizerPYD\", \"DynamicAudioNormalizerPYD\\DynamicAudioNormalizerPYD_VS2015.vcxproj\", \"{5ACB9827-9D3A-4C59-A948-8505D1544A8E}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Win32 = Debug|Win32\n\t\tDebug|x64 = Debug|x64\n\t\tRelease_DLL|Win32 = Release_DLL|Win32\n\t\tRelease_DLL|x64 = Release_DLL|x64\n\t\tRelease_Static|Win32 = Release_Static|Win32\n\t\tRelease_Static|x64 = Release_Static|x64\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{5B755CC3-EC17-490F-AE82-CBC16E2EB143}.Debug|Win32.ActiveCfg = Debug|Win32\n\t\t{5B755CC3-EC17-490F-AE82-CBC16E2EB143}.Debug|Win32.Build.0 = Debug|Win32\n\t\t{5B755CC3-EC17-490F-AE82-CBC16E2EB143}.Debug|x64.ActiveCfg = Debug|Win32\n\t\t{5B755CC3-EC17-490F-AE82-CBC16E2EB143}.Release_DLL|Win32.ActiveCfg = Release_DLL|Win32\n\t\t{5B755CC3-EC17-490F-AE82-CBC16E2EB143}.Release_DLL|Win32.Build.0 = Release_DLL|Win32\n\t\t{5B755CC3-EC17-490F-AE82-CBC16E2EB143}.Release_DLL|x64.ActiveCfg = Release_DLL|Win32\n\t\t{5B755CC3-EC17-490F-AE82-CBC16E2EB143}.Release_Static|Win32.ActiveCfg = Release_Static|Win32\n\t\t{5B755CC3-EC17-490F-AE82-CBC16E2EB143}.Release_Static|Win32.Build.0 = Release_Static|Win32\n\t\t{5B755CC3-EC17-490F-AE82-CBC16E2EB143}.Release_Static|x64.ActiveCfg = Release_Static|Win32\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Debug|Win32.ActiveCfg = Debug|Win32\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Debug|Win32.Build.0 = Debug|Win32\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Debug|x64.ActiveCfg = Debug|x64\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Debug|x64.Build.0 = Debug|x64\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Release_DLL|Win32.ActiveCfg = Release_DLL|Win32\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Release_DLL|Win32.Build.0 = Release_DLL|Win32\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Release_DLL|x64.ActiveCfg = Release_DLL|x64\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Release_DLL|x64.Build.0 = Release_DLL|x64\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Release_Static|Win32.ActiveCfg = Release_Static|Win32\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Release_Static|Win32.Build.0 = Release_Static|Win32\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Release_Static|x64.ActiveCfg = Release_Static|x64\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Release_Static|x64.Build.0 = Release_Static|x64\n\t\t{131C921A-7144-4C1D-9C97-57C43FA83DFE}.Debug|Win32.ActiveCfg = Debug|Win32\n\t\t{131C921A-7144-4C1D-9C97-57C43FA83DFE}.Debug|Win32.Build.0 = Debug|Win32\n\t\t{131C921A-7144-4C1D-9C97-57C43FA83DFE}.Debug|x64.ActiveCfg = Debug|Win32\n\t\t{131C921A-7144-4C1D-9C97-57C43FA83DFE}.Release_DLL|Win32.ActiveCfg = Release_DLL|Win32\n\t\t{131C921A-7144-4C1D-9C97-57C43FA83DFE}.Release_DLL|Win32.Build.0 = Release_DLL|Win32\n\t\t{131C921A-7144-4C1D-9C97-57C43FA83DFE}.Release_DLL|x64.ActiveCfg = Release_DLL|Win32\n\t\t{131C921A-7144-4C1D-9C97-57C43FA83DFE}.Release_Static|Win32.ActiveCfg = Release_Static|Win32\n\t\t{131C921A-7144-4C1D-9C97-57C43FA83DFE}.Release_Static|Win32.Build.0 = Release_Static|Win32\n\t\t{131C921A-7144-4C1D-9C97-57C43FA83DFE}.Release_Static|x64.ActiveCfg = Release_Static|Win32\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Debug|Win32.ActiveCfg = Debug|Win32\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Debug|Win32.Build.0 = Debug|Win32\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Debug|x64.ActiveCfg = Debug|x64\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Debug|x64.Build.0 = Debug|x64\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Release_DLL|Win32.ActiveCfg = Release_DLL|Win32\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Release_DLL|Win32.Build.0 = Release_DLL|Win32\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Release_DLL|x64.ActiveCfg = Release_DLL|x64\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Release_DLL|x64.Build.0 = Release_DLL|x64\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Release_Static|Win32.ActiveCfg = Release_Static|Win32\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Release_Static|Win32.Build.0 = Release_Static|Win32\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Release_Static|x64.ActiveCfg = Release_Static|x64\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Release_Static|x64.Build.0 = Release_Static|x64\n\t\t{4C09B776-E4AC-4459-9CEA-086011A0BA14}.Debug|Win32.ActiveCfg = Debug|Win32\n\t\t{4C09B776-E4AC-4459-9CEA-086011A0BA14}.Debug|Win32.Build.0 = Debug|Win32\n\t\t{4C09B776-E4AC-4459-9CEA-086011A0BA14}.Debug|x64.ActiveCfg = Debug|Win32\n\t\t{4C09B776-E4AC-4459-9CEA-086011A0BA14}.Release_DLL|Win32.ActiveCfg = Release_DLL|Win32\n\t\t{4C09B776-E4AC-4459-9CEA-086011A0BA14}.Release_DLL|Win32.Build.0 = Release_DLL|Win32\n\t\t{4C09B776-E4AC-4459-9CEA-086011A0BA14}.Release_DLL|x64.ActiveCfg = Release_DLL|Win32\n\t\t{4C09B776-E4AC-4459-9CEA-086011A0BA14}.Release_Static|Win32.ActiveCfg = Release_Static|Win32\n\t\t{4C09B776-E4AC-4459-9CEA-086011A0BA14}.Release_Static|Win32.Build.0 = Release_Static|Win32\n\t\t{4C09B776-E4AC-4459-9CEA-086011A0BA14}.Release_Static|x64.ActiveCfg = Release_Static|Win32\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Debug|Win32.ActiveCfg = Debug|Win32\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Debug|Win32.Build.0 = Debug|Win32\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Debug|x64.ActiveCfg = Debug|x64\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Debug|x64.Build.0 = Debug|x64\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Release_DLL|Win32.ActiveCfg = Release_DLL|Win32\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Release_DLL|Win32.Build.0 = Release_DLL|Win32\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Release_DLL|x64.ActiveCfg = Release_DLL|x64\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Release_DLL|x64.Build.0 = Release_DLL|x64\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Release_Static|Win32.ActiveCfg = Release_Static|Win32\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Release_Static|x64.ActiveCfg = Release_Static|x64\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Debug|Win32.ActiveCfg = Debug|Win32\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Debug|Win32.Build.0 = Debug|Win32\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Debug|x64.ActiveCfg = Debug|x64\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Debug|x64.Build.0 = Debug|x64\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Release_DLL|Win32.ActiveCfg = Release_DLL|Win32\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Release_DLL|Win32.Build.0 = Release_DLL|Win32\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Release_DLL|x64.ActiveCfg = Release_DLL|x64\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Release_DLL|x64.Build.0 = Release_DLL|x64\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Release_Static|Win32.ActiveCfg = Release_Static|Win32\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Release_Static|Win32.Build.0 = Release_Static|Win32\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Release_Static|x64.ActiveCfg = Release_Static|x64\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Release_Static|x64.Build.0 = Release_Static|x64\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n"
  },
  {
    "path": "DynamicAudioNormalizer_VS2017.props",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ImportGroup Label=\"PropertySheets\" />\n  <PropertyGroup Label=\"UserMacros\">\n    <XPDeprecationWarning>false</XPDeprecationWarning>\n  </PropertyGroup>\n  <PropertyGroup />\n  <ItemDefinitionGroup />\n  <ItemGroup>\n    <BuildMacro Include=\"XPDeprecationWarning\">\n      <Value>$(XPDeprecationWarning)</Value>\n    </BuildMacro>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "DynamicAudioNormalizer_VS2017.sln",
    "content": "﻿\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.26430.16\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"DynamicAudioNormalizerCLI\", \"DynamicAudioNormalizerCLI\\DynamicAudioNormalizerCLI_VS2017.vcxproj\", \"{5B755CC3-EC17-490F-AE82-CBC16E2EB143}\"\nEndProject\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"DynamicAudioNormalizerAPI\", \"DynamicAudioNormalizerAPI\\DynamicAudioNormalizerAPI_VS2017.vcxproj\", \"{376386EE-8268-47E3-A335-7663716E4C60}\"\nEndProject\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"DynamicAudioNormalizerGUI\", \"DynamicAudioNormalizerGUI\\DynamicAudioNormalizerGUI_VS2017.vcxproj\", \"{131C921A-7144-4C1D-9C97-57C43FA83DFE}\"\nEndProject\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"DynamicAudioNormalizerVST\", \"DynamicAudioNormalizerVST\\DynamicAudioNormalizerVST_VS2017.vcxproj\", \"{A30375E8-AEF7-4531-B372-02328E0B9D43}\"\nEndProject\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"DynamicAudioNormalizerWA5\", \"DynamicAudioNormalizerWA5\\DynamicAudioNormalizerWA5_VS2017.vcxproj\", \"{4C09B776-E4AC-4459-9CEA-086011A0BA14}\"\nEndProject\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"DynamicAudioNormalizerNET\", \"DynamicAudioNormalizerNET\\DynamicAudioNormalizerNET_VS2017.vcxproj\", \"{E1794071-AB51-45C7-B215-028F3DAA2219}\"\nEndProject\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"DynamicAudioNormalizerPYD\", \"DynamicAudioNormalizerPYD\\DynamicAudioNormalizerPYD_VS2017.vcxproj\", \"{5ACB9827-9D3A-4C59-A948-8505D1544A8E}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Win32 = Debug|Win32\n\t\tDebug|x64 = Debug|x64\n\t\tRelease_DLL|Win32 = Release_DLL|Win32\n\t\tRelease_DLL|x64 = Release_DLL|x64\n\t\tRelease_Static|Win32 = Release_Static|Win32\n\t\tRelease_Static|x64 = Release_Static|x64\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{5B755CC3-EC17-490F-AE82-CBC16E2EB143}.Debug|Win32.ActiveCfg = Debug|Win32\n\t\t{5B755CC3-EC17-490F-AE82-CBC16E2EB143}.Debug|Win32.Build.0 = Debug|Win32\n\t\t{5B755CC3-EC17-490F-AE82-CBC16E2EB143}.Debug|x64.ActiveCfg = Debug|Win32\n\t\t{5B755CC3-EC17-490F-AE82-CBC16E2EB143}.Release_DLL|Win32.ActiveCfg = Release_DLL|Win32\n\t\t{5B755CC3-EC17-490F-AE82-CBC16E2EB143}.Release_DLL|Win32.Build.0 = Release_DLL|Win32\n\t\t{5B755CC3-EC17-490F-AE82-CBC16E2EB143}.Release_DLL|x64.ActiveCfg = Release_DLL|Win32\n\t\t{5B755CC3-EC17-490F-AE82-CBC16E2EB143}.Release_Static|Win32.ActiveCfg = Release_Static|Win32\n\t\t{5B755CC3-EC17-490F-AE82-CBC16E2EB143}.Release_Static|Win32.Build.0 = Release_Static|Win32\n\t\t{5B755CC3-EC17-490F-AE82-CBC16E2EB143}.Release_Static|x64.ActiveCfg = Release_Static|Win32\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Debug|Win32.ActiveCfg = Debug|Win32\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Debug|Win32.Build.0 = Debug|Win32\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Debug|x64.ActiveCfg = Debug|x64\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Debug|x64.Build.0 = Debug|x64\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Release_DLL|Win32.ActiveCfg = Release_DLL|Win32\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Release_DLL|Win32.Build.0 = Release_DLL|Win32\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Release_DLL|x64.ActiveCfg = Release_DLL|x64\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Release_DLL|x64.Build.0 = Release_DLL|x64\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Release_Static|Win32.ActiveCfg = Release_Static|Win32\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Release_Static|Win32.Build.0 = Release_Static|Win32\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Release_Static|x64.ActiveCfg = Release_Static|x64\n\t\t{376386EE-8268-47E3-A335-7663716E4C60}.Release_Static|x64.Build.0 = Release_Static|x64\n\t\t{131C921A-7144-4C1D-9C97-57C43FA83DFE}.Debug|Win32.ActiveCfg = Debug|Win32\n\t\t{131C921A-7144-4C1D-9C97-57C43FA83DFE}.Debug|Win32.Build.0 = Debug|Win32\n\t\t{131C921A-7144-4C1D-9C97-57C43FA83DFE}.Debug|x64.ActiveCfg = Debug|Win32\n\t\t{131C921A-7144-4C1D-9C97-57C43FA83DFE}.Release_DLL|Win32.ActiveCfg = Release_DLL|Win32\n\t\t{131C921A-7144-4C1D-9C97-57C43FA83DFE}.Release_DLL|Win32.Build.0 = Release_DLL|Win32\n\t\t{131C921A-7144-4C1D-9C97-57C43FA83DFE}.Release_DLL|x64.ActiveCfg = Release_DLL|Win32\n\t\t{131C921A-7144-4C1D-9C97-57C43FA83DFE}.Release_Static|Win32.ActiveCfg = Release_Static|Win32\n\t\t{131C921A-7144-4C1D-9C97-57C43FA83DFE}.Release_Static|Win32.Build.0 = Release_Static|Win32\n\t\t{131C921A-7144-4C1D-9C97-57C43FA83DFE}.Release_Static|x64.ActiveCfg = Release_Static|Win32\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Debug|Win32.ActiveCfg = Debug|Win32\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Debug|Win32.Build.0 = Debug|Win32\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Debug|x64.ActiveCfg = Debug|x64\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Debug|x64.Build.0 = Debug|x64\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Release_DLL|Win32.ActiveCfg = Release_DLL|Win32\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Release_DLL|Win32.Build.0 = Release_DLL|Win32\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Release_DLL|x64.ActiveCfg = Release_DLL|x64\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Release_DLL|x64.Build.0 = Release_DLL|x64\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Release_Static|Win32.ActiveCfg = Release_Static|Win32\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Release_Static|Win32.Build.0 = Release_Static|Win32\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Release_Static|x64.ActiveCfg = Release_Static|x64\n\t\t{A30375E8-AEF7-4531-B372-02328E0B9D43}.Release_Static|x64.Build.0 = Release_Static|x64\n\t\t{4C09B776-E4AC-4459-9CEA-086011A0BA14}.Debug|Win32.ActiveCfg = Debug|Win32\n\t\t{4C09B776-E4AC-4459-9CEA-086011A0BA14}.Debug|Win32.Build.0 = Debug|Win32\n\t\t{4C09B776-E4AC-4459-9CEA-086011A0BA14}.Debug|x64.ActiveCfg = Debug|Win32\n\t\t{4C09B776-E4AC-4459-9CEA-086011A0BA14}.Release_DLL|Win32.ActiveCfg = Release_DLL|Win32\n\t\t{4C09B776-E4AC-4459-9CEA-086011A0BA14}.Release_DLL|Win32.Build.0 = Release_DLL|Win32\n\t\t{4C09B776-E4AC-4459-9CEA-086011A0BA14}.Release_DLL|x64.ActiveCfg = Release_DLL|Win32\n\t\t{4C09B776-E4AC-4459-9CEA-086011A0BA14}.Release_Static|Win32.ActiveCfg = Release_Static|Win32\n\t\t{4C09B776-E4AC-4459-9CEA-086011A0BA14}.Release_Static|Win32.Build.0 = Release_Static|Win32\n\t\t{4C09B776-E4AC-4459-9CEA-086011A0BA14}.Release_Static|x64.ActiveCfg = Release_Static|Win32\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Debug|Win32.ActiveCfg = Debug|Win32\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Debug|Win32.Build.0 = Debug|Win32\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Debug|x64.ActiveCfg = Debug|x64\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Debug|x64.Build.0 = Debug|x64\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Release_DLL|Win32.ActiveCfg = Release_DLL|Win32\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Release_DLL|Win32.Build.0 = Release_DLL|Win32\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Release_DLL|x64.ActiveCfg = Release_DLL|x64\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Release_DLL|x64.Build.0 = Release_DLL|x64\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Release_Static|Win32.ActiveCfg = Release_Static|Win32\n\t\t{E1794071-AB51-45C7-B215-028F3DAA2219}.Release_Static|x64.ActiveCfg = Release_Static|x64\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Debug|Win32.ActiveCfg = Debug|Win32\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Debug|Win32.Build.0 = Debug|Win32\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Debug|x64.ActiveCfg = Debug|x64\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Debug|x64.Build.0 = Debug|x64\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Release_DLL|Win32.ActiveCfg = Release_DLL|Win32\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Release_DLL|Win32.Build.0 = Release_DLL|Win32\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Release_DLL|x64.ActiveCfg = Release_DLL|x64\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Release_DLL|x64.Build.0 = Release_DLL|x64\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Release_Static|Win32.ActiveCfg = Release_Static|Win32\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Release_Static|Win32.Build.0 = Release_Static|Win32\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Release_Static|x64.ActiveCfg = Release_Static|x64\n\t\t{5ACB9827-9D3A-4C59-A948-8505D1544A8E}.Release_Static|x64.Build.0 = Release_Static|x64\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n"
  },
  {
    "path": "LICENSE-GPL2.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n<html><head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n <title>GNU General Public License v2.0 - GNU Project - Free Software Foundation (FSF)</title>\n <link rel=\"alternate\" type=\"application/rdf+xml\" href=\"http://www.gnu.org/licenses/old-licenses/gpl-2.0.rdf\"> \n</head>\n<body>\n<h3><a id=\"SEC1\">GNU GENERAL PUBLIC LICENSE</a></h3>\n<p>\nVersion 2, June 1991\n</p>\n\n<pre>Copyright (C) 1989, 1991 Free Software Foundation, Inc.  \n51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\n\nEveryone is permitted to copy and distribute verbatim copies\nof this license document, but changing it is not allowed.\n</pre>\n\n<h3><a id=\"preamble\"></a><a id=\"SEC2\">Preamble</a></h3>\n\n<p>\n  The licenses for most software are designed to take away your\nfreedom to share and change it.  By contrast, the GNU General Public\nLicense is intended to guarantee your freedom to share and change free\nsoftware--to make sure the software is free for all its users.  This\nGeneral Public License applies to most of the Free Software\nFoundation's software and to any other program whose authors commit to\nusing it.  (Some other Free Software Foundation software is covered by\nthe GNU Lesser General Public License instead.)  You can apply it to\nyour programs, too.\n</p>\n\n<p>\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthis service if you wish), that you receive source code or can get it\nif you want it, that you can change the software or use pieces of it\nin new free programs; and that you know you can do these things.\n</p>\n\n<p>\n  To protect your rights, we need to make restrictions that forbid\nanyone to deny you these rights or to ask you to surrender the rights.\nThese restrictions translate to certain responsibilities for you if you\ndistribute copies of the software, or if you modify it.\n</p>\n\n<p>\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must give the recipients all the rights that\nyou have.  You must make sure that they, too, receive or can get the\nsource code.  And you must show them these terms so they know their\nrights.\n</p>\n\n<p>\n  We protect your rights with two steps: (1) copyright the software, and\n(2) offer you this license which gives you legal permission to copy,\ndistribute and/or modify the software.\n</p>\n\n<p>\n  Also, for each author's protection and ours, we want to make certain\nthat everyone understands that there is no warranty for this free\nsoftware.  If the software is modified by someone else and passed on, we\nwant its recipients to know that what they have is not the original, so\nthat any problems introduced by others will not reflect on the original\nauthors' reputations.\n</p>\n\n<p>\n  Finally, any free program is threatened constantly by software\npatents.  We wish to avoid the danger that redistributors of a free\nprogram will individually obtain patent licenses, in effect making the\nprogram proprietary.  To prevent this, we have made it clear that any\npatent must be licensed for everyone's free use or not licensed at all.\n</p>\n\n<p>\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n</p>\n\n\n<h3><a id=\"terms\"></a><a id=\"SEC3\">TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</a></h3>\n\n\n<a id=\"section0\"></a><p>\n<strong>0.</strong>\n This License applies to any program or other work which contains\na notice placed by the copyright holder saying it may be distributed\nunder the terms of this General Public License.  The \"Program\", below,\nrefers to any such program or work, and a \"work based on the Program\"\nmeans either the Program or any derivative work under copyright law:\nthat is to say, a work containing the Program or a portion of it,\neither verbatim or with modifications and/or translated into another\nlanguage.  (Hereinafter, translation is included without limitation in\nthe term \"modification\".)  Each licensee is addressed as \"you\".\n</p>\n\n<p>\nActivities other than copying, distribution and modification are not\ncovered by this License; they are outside its scope.  The act of\nrunning the Program is not restricted, and the output from the Program\nis covered only if its contents constitute a work based on the\nProgram (independent of having been made by running the Program).\nWhether that is true depends on what the Program does.\n</p>\n\n<a id=\"section1\"></a><p>\n<strong>1.</strong>\n You may copy and distribute verbatim copies of the Program's\nsource code as you receive it, in any medium, provided that you\nconspicuously and appropriately publish on each copy an appropriate\ncopyright notice and disclaimer of warranty; keep intact all the\nnotices that refer to this License and to the absence of any warranty;\nand give any other recipients of the Program a copy of this License\nalong with the Program.\n</p>\n\n<p>\nYou may charge a fee for the physical act of transferring a copy, and\nyou may at your option offer warranty protection in exchange for a fee.\n</p>\n\n<a id=\"section2\"></a><p>\n<strong>2.</strong>\n You may modify your copy or copies of the Program or any portion\nof it, thus forming a work based on the Program, and copy and\ndistribute such modifications or work under the terms of Section 1\nabove, provided that you also meet all of these conditions:\n</p>\n\n<dl>\n  <dt></dt>\n    <dd>\n      <strong>a)</strong>\n      You must cause the modified files to carry prominent notices\n      stating that you changed the files and the date of any change.\n    </dd>\n  <dt></dt>\n    <dd>\n      <strong>b)</strong>\n      You must cause any work that you distribute or publish, that in\n      whole or in part contains or is derived from the Program or any\n      part thereof, to be licensed as a whole at no charge to all third\n      parties under the terms of this License.\n    </dd>\n  <dt></dt>\n    <dd>\n      <strong>c)</strong>\n      If the modified program normally reads commands interactively\n      when run, you must cause it, when started running for such\n      interactive use in the most ordinary way, to print or display an\n      announcement including an appropriate copyright notice and a\n      notice that there is no warranty (or else, saying that you provide\n      a warranty) and that users may redistribute the program under\n      these conditions, and telling the user how to view a copy of this\n      License.  (Exception: if the Program itself is interactive but\n      does not normally print such an announcement, your work based on\n      the Program is not required to print an announcement.)\n    </dd>\n</dl>\n\n<p>\nThese requirements apply to the modified work as a whole.  If\nidentifiable sections of that work are not derived from the Program,\nand can be reasonably considered independent and separate works in\nthemselves, then this License, and its terms, do not apply to those\nsections when you distribute them as separate works.  But when you\ndistribute the same sections as part of a whole which is a work based\non the Program, the distribution of the whole must be on the terms of\nthis License, whose permissions for other licensees extend to the\nentire whole, and thus to each and every part regardless of who wrote it.\n</p>\n\n<p>\nThus, it is not the intent of this section to claim rights or contest\nyour rights to work written entirely by you; rather, the intent is to\nexercise the right to control the distribution of derivative or\ncollective works based on the Program.\n</p>\n\n<p>\nIn addition, mere aggregation of another work not based on the Program\nwith the Program (or with a work based on the Program) on a volume of\na storage or distribution medium does not bring the other work under\nthe scope of this License.\n</p>\n\n<a id=\"section3\"></a><p>\n<strong>3.</strong>\n You may copy and distribute the Program (or a work based on it,\nunder Section 2) in object code or executable form under the terms of\nSections 1 and 2 above provided that you also do one of the following:\n</p>\n\n<!-- we use this doubled UL to get the sub-sections indented, -->\n<!-- while making the bullets as unobvious as possible. -->\n\n<dl>\n  <dt></dt>\n    <dd>\n      <strong>a)</strong>\n      Accompany it with the complete corresponding machine-readable\n      source code, which must be distributed under the terms of Sections\n      1 and 2 above on a medium customarily used for software interchange; or,\n    </dd>\n  <dt></dt>\n    <dd>\n      <strong>b)</strong>\n      Accompany it with a written offer, valid for at least three\n      years, to give any third party, for a charge no more than your\n      cost of physically performing source distribution, a complete\n      machine-readable copy of the corresponding source code, to be\n      distributed under the terms of Sections 1 and 2 above on a medium\n      customarily used for software interchange; or,\n    </dd>\n  <dt></dt>\n    <dd>\n      <strong>c)</strong>\n      Accompany it with the information you received as to the offer\n      to distribute corresponding source code.  (This alternative is\n      allowed only for noncommercial distribution and only if you\n      received the program in object code or executable form with such\n      an offer, in accord with Subsection b above.)\n    </dd>\n</dl>\n\n<p>\nThe source code for a work means the preferred form of the work for\nmaking modifications to it.  For an executable work, complete source\ncode means all the source code for all modules it contains, plus any\nassociated interface definition files, plus the scripts used to\ncontrol compilation and installation of the executable.  However, as a\nspecial exception, the source code distributed need not include\nanything that is normally distributed (in either source or binary\nform) with the major components (compiler, kernel, and so on) of the\noperating system on which the executable runs, unless that component\nitself accompanies the executable.\n</p>\n\n<p>\nIf distribution of executable or object code is made by offering\naccess to copy from a designated place, then offering equivalent\naccess to copy the source code from the same place counts as\ndistribution of the source code, even though third parties are not\ncompelled to copy the source along with the object code.\n</p>\n\n<a id=\"section4\"></a><p>\n<strong>4.</strong>\n You may not copy, modify, sublicense, or distribute the Program\nexcept as expressly provided under this License.  Any attempt\notherwise to copy, modify, sublicense or distribute the Program is\nvoid, and will automatically terminate your rights under this License.\nHowever, parties who have received copies, or rights, from you under\nthis License will not have their licenses terminated so long as such\nparties remain in full compliance.\n</p>\n\n<a id=\"section5\"></a><p>\n<strong>5.</strong>\n You are not required to accept this License, since you have not\nsigned it.  However, nothing else grants you permission to modify or\ndistribute the Program or its derivative works.  These actions are\nprohibited by law if you do not accept this License.  Therefore, by\nmodifying or distributing the Program (or any work based on the\nProgram), you indicate your acceptance of this License to do so, and\nall its terms and conditions for copying, distributing or modifying\nthe Program or works based on it.\n</p>\n\n<a id=\"section6\"></a><p>\n<strong>6.</strong>\n Each time you redistribute the Program (or any work based on the\nProgram), the recipient automatically receives a license from the\noriginal licensor to copy, distribute or modify the Program subject to\nthese terms and conditions.  You may not impose any further\nrestrictions on the recipients' exercise of the rights granted herein.\nYou are not responsible for enforcing compliance by third parties to\nthis License.\n</p>\n\n<a id=\"section7\"></a><p>\n<strong>7.</strong>\n If, as a consequence of a court judgment or allegation of patent\ninfringement or for any other reason (not limited to patent issues),\nconditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot\ndistribute so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you\nmay not distribute the Program at all.  For example, if a patent\nlicense would not permit royalty-free redistribution of the Program by\nall those who receive copies directly or indirectly through you, then\nthe only way you could satisfy both it and this License would be to\nrefrain entirely from distribution of the Program.\n</p>\n\n<p>\nIf any portion of this section is held invalid or unenforceable under\nany particular circumstance, the balance of the section is intended to\napply and the section as a whole is intended to apply in other\ncircumstances.\n</p>\n\n<p>\nIt is not the purpose of this section to induce you to infringe any\npatents or other property right claims or to contest validity of any\nsuch claims; this section has the sole purpose of protecting the\nintegrity of the free software distribution system, which is\nimplemented by public license practices.  Many people have made\ngenerous contributions to the wide range of software distributed\nthrough that system in reliance on consistent application of that\nsystem; it is up to the author/donor to decide if he or she is willing\nto distribute software through any other system and a licensee cannot\nimpose that choice.\n</p>\n\n<p>\nThis section is intended to make thoroughly clear what is believed to\nbe a consequence of the rest of this License.\n</p>\n\n<a id=\"section8\"></a><p>\n<strong>8.</strong>\n If the distribution and/or use of the Program is restricted in\ncertain countries either by patents or by copyrighted interfaces, the\noriginal copyright holder who places the Program under this License\nmay add an explicit geographical distribution limitation excluding\nthose countries, so that distribution is permitted only in or among\ncountries not thus excluded.  In such case, this License incorporates\nthe limitation as if written in the body of this License.\n</p>\n\n<a id=\"section9\"></a><p>\n<strong>9.</strong>\n The Free Software Foundation may publish revised and/or new versions\nof the General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n</p>\n\n<p>\nEach version is given a distinguishing version number.  If the Program\nspecifies a version number of this License which applies to it and \"any\nlater version\", you have the option of following the terms and conditions\neither of that version or of any later version published by the Free\nSoftware Foundation.  If the Program does not specify a version number of\nthis License, you may choose any version ever published by the Free Software\nFoundation.\n</p>\n\n<a id=\"section10\"></a><p>\n<strong>10.</strong>\n If you wish to incorporate parts of the Program into other free\nprograms whose distribution conditions are different, write to the author\nto ask for permission.  For software which is copyrighted by the Free\nSoftware Foundation, write to the Free Software Foundation; we sometimes\nmake exceptions for this.  Our decision will be guided by the two goals\nof preserving the free status of all derivatives of our free software and\nof promoting the sharing and reuse of software generally.\n</p>\n\n<a id=\"section11\"></a><p><strong>NO WARRANTY</strong></p>\n\n<p>\n<strong>11.</strong>\n BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\nFOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN\nOTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\nPROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\nOR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS\nTO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE\nPROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\nREPAIR OR CORRECTION.\n</p>\n\n<a id=\"section12\"></a><p>\n<strong>12.</strong>\n IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\nREDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\nINCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\nOUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\nTO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\nYOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\nPROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGES.\n</p>\n\n<h3>END OF TERMS AND CONDITIONS</h3>\n\n<h3><a id=\"howto\"></a><a id=\"SEC4\">How to Apply These Terms to Your New Programs</a></h3>\n\n<p>\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n</p>\n\n<p>\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nconvey the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n</p>\n\n<pre><var>one line to give the program's name and an idea of what it does.</var>\nCopyright (C) <var>yyyy</var>  <var>name of author</var>\n\nThis program is free software; you can redistribute it and/or\nmodify it under the terms of the GNU General Public License\nas published by the Free Software Foundation; either version 2\nof the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software\nFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n</pre>\n\n<p>\nAlso add information on how to contact you by electronic and paper mail.\n</p>\n\n<p>\nIf the program is interactive, make it output a short notice like this\nwhen it starts in an interactive mode:\n</p>\n\n<pre>Gnomovision version 69, Copyright (C) <var>year</var> <var>name of author</var>\nGnomovision comes with ABSOLUTELY NO WARRANTY; for details\ntype `show w'.  This is free software, and you are welcome\nto redistribute it under certain conditions; type `show c' \nfor details.\n</pre>\n\n<p>\nThe hypothetical commands <samp>`show w'</samp> and <samp>`show c'</samp> should show\nthe appropriate parts of the General Public License.  Of course, the\ncommands you use may be called something other than <samp>`show w'</samp> and\n<samp>`show c'</samp>; they could even be mouse-clicks or menu items--whatever\nsuits your program.\n</p>\n\n<p>\nYou should also get your employer (if you work as a programmer) or your\nschool, if any, to sign a \"copyright disclaimer\" for the program, if\nnecessary.  Here is a sample; alter the names:\n</p>\n\n\n<pre>Yoyodyne, Inc., hereby disclaims all copyright\ninterest in the program `Gnomovision'\n(which makes passes at compilers) written \nby James Hacker.\n\n<var>signature of Ty Coon</var>, 1 April 1989\nTy Coon, President of Vice\n</pre>\n\n<p>\nThis General Public License does not permit incorporating your program into\nproprietary programs.  If your program is a subroutine library, you may\nconsider it more useful to permit linking proprietary applications with the\nlibrary.  If this is what you want to do, use the \n<a href=\"http://www.gnu.org/licenses/lgpl.html\">GNU Lesser General Public License</a>\ninstead of this License.\n</p>\n\n\n</body></html>"
  },
  {
    "path": "LICENSE-GPL3.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n<html><head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n <title>GNU General Public License v3.0 - GNU Project - Free Software Foundation (FSF)</title>\n <link rel=\"alternate\" type=\"application/rdf+xml\" href=\"http://www.gnu.org/licenses/gpl-3.0.rdf\"> \n</head>\n<body>\n<h3 style=\"text-align: center;\">GNU GENERAL PUBLIC LICENSE</h3>\n<p style=\"text-align: center;\">Version 3, 29 June 2007</p>\n\n<p>Copyright © 2007 Free Software Foundation, Inc.\n &lt;<a href=\"http://fsf.org/\">http://fsf.org/</a>&gt;</p><p>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.</p>\n\n<h3><a name=\"preamble\"></a>Preamble</h3>\n\n<p>The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.</p>\n\n<p>The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.</p>\n\n<p>When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.</p>\n\n<p>To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.</p>\n\n<p>For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.</p>\n\n<p>Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.</p>\n\n<p>For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.</p>\n\n<p>Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.</p>\n\n<p>Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.</p>\n\n<p>The precise terms and conditions for copying, distribution and\nmodification follow.</p>\n\n<h3><a name=\"terms\"></a>TERMS AND CONDITIONS</h3>\n\n<h4><a name=\"section0\"></a>0. Definitions.</h4>\n\n<p>“This License” refers to version 3 of the GNU General Public License.</p>\n\n<p>“Copyright” also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.</p>\n \n<p>“The Program” refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as “you”.  “Licensees” and\n“recipients” may be individuals or organizations.</p>\n\n<p>To “modify” a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a “modified version” of the\nearlier work or a work “based on” the earlier work.</p>\n\n<p>A “covered work” means either the unmodified Program or a work based\non the Program.</p>\n\n<p>To “propagate” a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.</p>\n\n<p>To “convey” a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.</p>\n\n<p>An interactive user interface displays “Appropriate Legal Notices”\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.</p>\n\n<h4><a name=\"section1\"></a>1. Source Code.</h4>\n\n<p>The “source code” for a work means the preferred form of the work\nfor making modifications to it.  “Object code” means any non-source\nform of a work.</p>\n\n<p>A “Standard Interface” means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.</p>\n\n<p>The “System Libraries” of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n“Major Component”, in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.</p>\n\n<p>The “Corresponding Source” for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.</p>\n\n<p>The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.</p>\n\n<p>The Corresponding Source for a work in source code form is that\nsame work.</p>\n\n<h4><a name=\"section2\"></a>2. Basic Permissions.</h4>\n\n<p>All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.</p>\n\n<p>You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.</p>\n\n<p>Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.</p>\n\n<h4><a name=\"section3\"></a>3. Protecting Users' Legal Rights From Anti-Circumvention Law.</h4>\n\n<p>No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.</p>\n\n<p>When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.</p>\n\n<h4><a name=\"section4\"></a>4. Conveying Verbatim Copies.</h4>\n\n<p>You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.</p>\n\n<p>You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.</p>\n\n<h4><a name=\"section5\"></a>5. Conveying Modified Source Versions.</h4>\n\n<p>You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:</p>\n\n<ul>\n<li>a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.</li>\n\n<li>b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    “keep intact all notices”.</li>\n\n<li>c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.</li>\n\n<li>d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.</li>\n</ul>\n\n<p>A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n“aggregate” if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.</p>\n\n<h4><a name=\"section6\"></a>6. Conveying Non-Source Forms.</h4>\n\n<p>You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:</p>\n\n<ul>\n<li>a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.</li>\n\n<li>b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.</li>\n\n<li>c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.</li>\n\n<li>d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.</li>\n\n<li>e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.</li>\n</ul>\n\n<p>A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.</p>\n\n<p>A “User Product” is either (1) a “consumer product”, which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, “normally used” refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.</p>\n\n<p>“Installation Information” for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.</p>\n\n<p>If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).</p>\n\n<p>The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.</p>\n\n<p>Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.</p>\n\n<h4><a name=\"section7\"></a>7. Additional Terms.</h4>\n\n<p>“Additional permissions” are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.</p>\n\n<p>When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.</p>\n\n<p>Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:</p>\n\n<ul>\n<li>a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or</li>\n\n<li>b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or</li>\n\n<li>c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or</li>\n\n<li>d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or</li>\n\n<li>e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or</li>\n\n<li>f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.</li>\n</ul>\n\n<p>All other non-permissive additional terms are considered “further\nrestrictions” within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.</p>\n\n<p>If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.</p>\n\n<p>Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.</p>\n\n<h4><a name=\"section8\"></a>8. Termination.</h4>\n\n<p>You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).</p>\n\n<p>However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.</p>\n\n<p>Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.</p>\n\n<p>Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.</p>\n\n<h4><a name=\"section9\"></a>9. Acceptance Not Required for Having Copies.</h4>\n\n<p>You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.</p>\n\n<h4><a name=\"section10\"></a>10. Automatic Licensing of Downstream Recipients.</h4>\n\n<p>Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.</p>\n\n<p>An “entity transaction” is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.</p>\n\n<p>You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.</p>\n\n<h4><a name=\"section11\"></a>11. Patents.</h4>\n\n<p>A “contributor” is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's “contributor version”.</p>\n\n<p>A contributor's “essential patent claims” are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, “control” includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.</p>\n\n<p>Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.</p>\n\n<p>In the following three paragraphs, a “patent license” is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To “grant” such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.</p>\n\n<p>If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  “Knowingly relying” means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.</p>\n  \n<p>If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.</p>\n\n<p>A patent license is “discriminatory” if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.</p>\n\n<p>Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.</p>\n\n<h4><a name=\"section12\"></a>12. No Surrender of Others' Freedom.</h4>\n\n<p>If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.</p>\n\n<h4><a name=\"section13\"></a>13. Use with the GNU Affero General Public License.</h4>\n\n<p>Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.</p>\n\n<h4><a name=\"section14\"></a>14. Revised Versions of this License.</h4>\n\n<p>The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.</p>\n\n<p>Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License “or any later version” applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.</p>\n\n<p>If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.</p>\n\n<p>Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.</p>\n\n<h4><a name=\"section15\"></a>15. Disclaimer of Warranty.</h4>\n\n<p>THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.</p>\n\n<h4><a name=\"section16\"></a>16. Limitation of Liability.</h4>\n\n<p>IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.</p>\n\n<h4><a name=\"section17\"></a>17. Interpretation of Sections 15 and 16.</h4>\n\n<p>If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.</p>\n\n<p>END OF TERMS AND CONDITIONS</p>\n\n<h3><a name=\"howto\"></a>How to Apply These Terms to Your New Programs</h3>\n\n<p>If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.</p>\n\n<p>To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe “copyright” line and a pointer to where the full notice is found.</p>\n\n<pre>    &lt;one line to give the program's name and a brief idea of what it does.&gt;\n    Copyright (C) &lt;year&gt;  &lt;name of author&gt;\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see &lt;http://www.gnu.org/licenses/&gt;.\n</pre>\n\n<p>Also add information on how to contact you by electronic and paper mail.</p>\n\n<p>If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:</p>\n\n<pre>    &lt;program&gt;  Copyright (C) &lt;year&gt;  &lt;name of author&gt;\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n</pre>\n\n<p>The hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an “about box”.</p>\n\n<p>You should also get your employer (if you work as a programmer) or school,\nif any, to sign a “copyright disclaimer” for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n&lt;<a href=\"http://www.gnu.org/licenses/\">http://www.gnu.org/licenses/</a>&gt;.</p>\n\n<p>The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n&lt;<a href=\"http://www.gnu.org/philosophy/why-not-lgpl.html\">http://www.gnu.org/philosophy/why-not-lgpl.html</a>&gt;.</p>\n\n\n</body></html>"
  },
  {
    "path": "LICENSE-LGPL.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n<html><head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n <title>GNU Lesser General Public License v2.1 - GNU Project - Free Software Foundation (FSF)</title>\n <link rel=\"alternate\" type=\"application/rdf+xml\" href=\"http://www.gnu.org/licenses/old-licenses/lgpl-2.1.rdf\"> \n</head>\n<body>\n<h3><a id=\"SEC1\">GNU LESSER GENERAL PUBLIC LICENSE</a></h3>\n<p>\nVersion 2.1, February 1999\n</p>\n\n<pre>Copyright (C) 1991, 1999 Free Software Foundation, Inc.\n51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\nEveryone is permitted to copy and distribute verbatim copies\nof this license document, but changing it is not allowed.\n\n[This is the first released version of the Lesser GPL.  It also counts\n as the successor of the GNU Library Public License, version 2, hence\n the version number 2.1.]\n</pre>\n\n\n<h3><a id=\"SEC2\">Preamble</a></h3>\n\n<p>\n  The licenses for most software are designed to take away your\nfreedom to share and change it.  By contrast, the GNU General Public\nLicenses are intended to guarantee your freedom to share and change\nfree software--to make sure the software is free for all its users.\n</p>\n<p>\n  This license, the Lesser General Public License, applies to some\nspecially designated software packages--typically libraries--of the\nFree Software Foundation and other authors who decide to use it.  You\ncan use it too, but we suggest you first think carefully about whether\nthis license or the ordinary General Public License is the better\nstrategy to use in any particular case, based on the explanations below.\n</p>\n<p>\n  When we speak of free software, we are referring to freedom of use,\nnot price.  Our General Public Licenses are designed to make sure that\nyou have the freedom to distribute copies of free software (and charge\nfor this service if you wish); that you receive source code or can get\nit if you want it; that you can change the software and use pieces of\nit in new free programs; and that you are informed that you can do\nthese things.\n</p>\n<p>\n  To protect your rights, we need to make restrictions that forbid\ndistributors to deny you these rights or to ask you to surrender these\nrights.  These restrictions translate to certain responsibilities for\nyou if you distribute copies of the library or if you modify it.\n</p>\n<p>\n  For example, if you distribute copies of the library, whether gratis\nor for a fee, you must give the recipients all the rights that we gave\nyou.  You must make sure that they, too, receive or can get the source\ncode.  If you link other code with the library, you must provide\ncomplete object files to the recipients, so that they can relink them\nwith the library after making changes to the library and recompiling\nit.  And you must show them these terms so they know their rights.\n</p>\n<p>\n  We protect your rights with a two-step method: (1) we copyright the\nlibrary, and (2) we offer you this license, which gives you legal\npermission to copy, distribute and/or modify the library.\n</p>\n<p>\n  To protect each distributor, we want to make it very clear that\nthere is no warranty for the free library.  Also, if the library is\nmodified by someone else and passed on, the recipients should know\nthat what they have is not the original version, so that the original\nauthor's reputation will not be affected by problems that might be\nintroduced by others.\n</p>\n<p>\n  Finally, software patents pose a constant threat to the existence of\nany free program.  We wish to make sure that a company cannot\neffectively restrict the users of a free program by obtaining a\nrestrictive license from a patent holder.  Therefore, we insist that\nany patent license obtained for a version of the library must be\nconsistent with the full freedom of use specified in this license.\n</p>\n<p>\n  Most GNU software, including some libraries, is covered by the\nordinary GNU General Public License.  This license, the GNU Lesser\nGeneral Public License, applies to certain designated libraries, and\nis quite different from the ordinary General Public License.  We use\nthis license for certain libraries in order to permit linking those\nlibraries into non-free programs.\n</p>\n<p>\n  When a program is linked with a library, whether statically or using\na shared library, the combination of the two is legally speaking a\ncombined work, a derivative of the original library.  The ordinary\nGeneral Public License therefore permits such linking only if the\nentire combination fits its criteria of freedom.  The Lesser General\nPublic License permits more lax criteria for linking other code with\nthe library.\n</p>\n<p>\n  We call this license the \"Lesser\" General Public License because it\ndoes Less to protect the user's freedom than the ordinary General\nPublic License.  It also provides other free software developers Less\nof an advantage over competing non-free programs.  These disadvantages\nare the reason we use the ordinary General Public License for many\nlibraries.  However, the Lesser license provides advantages in certain\nspecial circumstances.\n</p>\n<p>\n  For example, on rare occasions, there may be a special need to\nencourage the widest possible use of a certain library, so that it becomes\na de-facto standard.  To achieve this, non-free programs must be\nallowed to use the library.  A more frequent case is that a free\nlibrary does the same job as widely used non-free libraries.  In this\ncase, there is little to gain by limiting the free library to free\nsoftware only, so we use the Lesser General Public License.\n</p>\n<p>\n  In other cases, permission to use a particular library in non-free\nprograms enables a greater number of people to use a large body of\nfree software.  For example, permission to use the GNU C Library in\nnon-free programs enables many more people to use the whole GNU\noperating system, as well as its variant, the GNU/Linux operating\nsystem.\n</p>\n<p>\n  Although the Lesser General Public License is Less protective of the\nusers' freedom, it does ensure that the user of a program that is\nlinked with the Library has the freedom and the wherewithal to run\nthat program using a modified version of the Library.\n</p>\n<p>\n  The precise terms and conditions for copying, distribution and\nmodification follow.  Pay close attention to the difference between a\n\"work based on the library\" and a \"work that uses the library\".  The\nformer contains code derived from the library, whereas the latter must\nbe combined with the library in order to run.\n</p>\n\n<h3><a id=\"SEC3\">TERMS AND CONDITIONS FOR COPYING,\nDISTRIBUTION AND MODIFICATION</a></h3>\n\n\n<p>\n<strong>0.</strong>\nThis License Agreement applies to any software library or other\nprogram which contains a notice placed by the copyright holder or\nother authorized party saying it may be distributed under the terms of\nthis Lesser General Public License (also called \"this License\").\nEach licensee is addressed as \"you\".\n</p>\n<p>\n  A \"library\" means a collection of software functions and/or data\nprepared so as to be conveniently linked with application programs\n(which use some of those functions and data) to form executables.\n</p>\n<p>\n  The \"Library\", below, refers to any such software library or work\nwhich has been distributed under these terms.  A \"work based on the\nLibrary\" means either the Library or any derivative work under\ncopyright law: that is to say, a work containing the Library or a\nportion of it, either verbatim or with modifications and/or translated\nstraightforwardly into another language.  (Hereinafter, translation is\nincluded without limitation in the term \"modification\".)\n</p>\n<p>\n  \"Source code\" for a work means the preferred form of the work for\nmaking modifications to it.  For a library, complete source code means\nall the source code for all modules it contains, plus any associated\ninterface definition files, plus the scripts used to control compilation\nand installation of the library.\n</p>\n<p>\n  Activities other than copying, distribution and modification are not\ncovered by this License; they are outside its scope.  The act of\nrunning a program using the Library is not restricted, and output from\nsuch a program is covered only if its contents constitute a work based\non the Library (independent of the use of the Library in a tool for\nwriting it).  Whether that is true depends on what the Library does\nand what the program that uses the Library does.\n</p>\n<p>\n<strong>1.</strong>\nYou may copy and distribute verbatim copies of the Library's\ncomplete source code as you receive it, in any medium, provided that\nyou conspicuously and appropriately publish on each copy an\nappropriate copyright notice and disclaimer of warranty; keep intact\nall the notices that refer to this License and to the absence of any\nwarranty; and distribute a copy of this License along with the\nLibrary.\n</p>\n<p>\n  You may charge a fee for the physical act of transferring a copy,\nand you may at your option offer warranty protection in exchange for a\nfee.\n</p>\n<p>\n<strong>2.</strong>\nYou may modify your copy or copies of the Library or any portion\nof it, thus forming a work based on the Library, and copy and\ndistribute such modifications or work under the terms of Section 1\nabove, provided that you also meet all of these conditions:\n</p>\n\n<ul>\n  <li><strong>a)</strong>\n       The modified work must itself be a software library.</li>\n  <li><strong>b)</strong>\n       You must cause the files modified to carry prominent notices\n       stating that you changed the files and the date of any change.</li>\n\n  <li><strong>c)</strong>\n       You must cause the whole of the work to be licensed at no\n       charge to all third parties under the terms of this License.</li>\n\n  <li><strong>d)</strong>\n       If a facility in the modified Library refers to a function or a\n       table of data to be supplied by an application program that uses\n       the facility, other than as an argument passed when the facility\n       is invoked, then you must make a good faith effort to ensure that,\n       in the event an application does not supply such function or\n       table, the facility still operates, and performs whatever part of\n       its purpose remains meaningful.\n       <p>\n       (For example, a function in a library to compute square roots has\n       a purpose that is entirely well-defined independent of the\n       application.  Therefore, Subsection 2d requires that any\n       application-supplied function or table used by this function must\n       be optional: if the application does not supply it, the square\n       root function must still compute square roots.)</p></li>\n</ul>\n\n<p>\nThese requirements apply to the modified work as a whole.  If identifiable\nsections of that work are not derived from the Library, and can be\nreasonably considered independent and separate works in themselves, then\nthis License, and its terms, do not apply to those sections when you\ndistribute them as separate works.  But when you distribute the same\nsections as part of a whole which is a work based on the Library, the\ndistribution of the whole must be on the terms of this License, whose\npermissions for other licensees extend to the entire whole, and thus to\neach and every part regardless of who wrote it.\n</p>\n<p>\nThus, it is not the intent of this section to claim rights or contest your\nrights to work written entirely by you; rather, the intent is to exercise\nthe right to control the distribution of derivative or collective works\nbased on the Library.\n</p>\n<p>\nIn addition, mere aggregation of another work not based on the Library with\nthe Library (or with a work based on the Library) on a volume of a storage\nor distribution medium does not bring the other work under the scope of\nthis License.\n</p>\n<p>\n<strong>3.</strong>\nYou may opt to apply the terms of the ordinary GNU General Public\nLicense instead of this License to a given copy of the Library.  To do\nthis, you must alter all the notices that refer to this License, so\nthat they refer to the ordinary GNU General Public License, version 2,\ninstead of to this License.  (If a newer version than version 2 of the\nordinary GNU General Public License has appeared, then you can specify\nthat version instead if you wish.)  Do not make any other change in\nthese notices.\n</p>\n<p>\n  Once this change is made in a given copy, it is irreversible for\nthat copy, so the ordinary GNU General Public License applies to all\nsubsequent copies and derivative works made from that copy.\n</p>\n<p>\n  This option is useful when you wish to copy part of the code of\nthe Library into a program that is not a library.\n</p>\n<p>\n<strong>4.</strong>\nYou may copy and distribute the Library (or a portion or\nderivative of it, under Section 2) in object code or executable form\nunder the terms of Sections 1 and 2 above provided that you accompany\nit with the complete corresponding machine-readable source code, which\nmust be distributed under the terms of Sections 1 and 2 above on a\nmedium customarily used for software interchange.\n</p>\n<p>\n  If distribution of object code is made by offering access to copy\nfrom a designated place, then offering equivalent access to copy the\nsource code from the same place satisfies the requirement to\ndistribute the source code, even though third parties are not\ncompelled to copy the source along with the object code.\n</p>\n<p>\n<strong>5.</strong>\nA program that contains no derivative of any portion of the\nLibrary, but is designed to work with the Library by being compiled or\nlinked with it, is called a \"work that uses the Library\".  Such a\nwork, in isolation, is not a derivative work of the Library, and\ntherefore falls outside the scope of this License.\n</p>\n<p>\n  However, linking a \"work that uses the Library\" with the Library\ncreates an executable that is a derivative of the Library (because it\ncontains portions of the Library), rather than a \"work that uses the\nlibrary\".  The executable is therefore covered by this License.\nSection 6 states terms for distribution of such executables.\n</p>\n<p>\n  When a \"work that uses the Library\" uses material from a header file\nthat is part of the Library, the object code for the work may be a\nderivative work of the Library even though the source code is not.\nWhether this is true is especially significant if the work can be\nlinked without the Library, or if the work is itself a library.  The\nthreshold for this to be true is not precisely defined by law.\n</p>\n<p>\n  If such an object file uses only numerical parameters, data\nstructure layouts and accessors, and small macros and small inline\nfunctions (ten lines or less in length), then the use of the object\nfile is unrestricted, regardless of whether it is legally a derivative\nwork.  (Executables containing this object code plus portions of the\nLibrary will still fall under Section 6.)\n</p>\n<p>\n  Otherwise, if the work is a derivative of the Library, you may\ndistribute the object code for the work under the terms of Section 6.\nAny executables containing that work also fall under Section 6,\nwhether or not they are linked directly with the Library itself.\n</p>\n<p>\n<strong>6.</strong>\nAs an exception to the Sections above, you may also combine or\nlink a \"work that uses the Library\" with the Library to produce a\nwork containing portions of the Library, and distribute that work\nunder terms of your choice, provided that the terms permit\nmodification of the work for the customer's own use and reverse\nengineering for debugging such modifications.\n</p>\n<p>\n  You must give prominent notice with each copy of the work that the\nLibrary is used in it and that the Library and its use are covered by\nthis License.  You must supply a copy of this License.  If the work\nduring execution displays copyright notices, you must include the\ncopyright notice for the Library among them, as well as a reference\ndirecting the user to the copy of this License.  Also, you must do one\nof these things:\n</p>\n\n<ul>\n    <li><strong>a)</strong> Accompany the work with the complete\n    corresponding machine-readable source code for the Library\n    including whatever changes were used in the work (which must be\n    distributed under Sections 1 and 2 above); and, if the work is an\n    executable linked with the Library, with the complete\n    machine-readable \"work that uses the Library\", as object code\n    and/or source code, so that the user can modify the Library and\n    then relink to produce a modified executable containing the\n    modified Library.  (It is understood that the user who changes the\n    contents of definitions files in the Library will not necessarily\n    be able to recompile the application to use the modified\n    definitions.)</li>\n\n    <li><strong>b)</strong> Use a suitable shared library mechanism\n    for linking with the Library.  A suitable mechanism is one that\n    (1) uses at run time a copy of the library already present on the\n    user's computer system, rather than copying library functions into\n    the executable, and (2) will operate properly with a modified\n    version of the library, if the user installs one, as long as the\n    modified version is interface-compatible with the version that the\n    work was made with.</li>\n\n    <li><strong>c)</strong> Accompany the work with a written offer,\n    valid for at least three years, to give the same user the\n    materials specified in Subsection 6a, above, for a charge no more\n    than the cost of performing this distribution.</li>\n\n    <li><strong>d)</strong> If distribution of the work is made by\n    offering access to copy from a designated place, offer equivalent\n    access to copy the above specified materials from the same\n    place.</li>\n\n    <li><strong>e)</strong> Verify that the user has already received\n    a copy of these materials or that you have already sent this user\n    a copy.</li>\n</ul>\n\n<p>\n  For an executable, the required form of the \"work that uses the\nLibrary\" must include any data and utility programs needed for\nreproducing the executable from it.  However, as a special exception,\nthe materials to be distributed need not include anything that is\nnormally distributed (in either source or binary form) with the major\ncomponents (compiler, kernel, and so on) of the operating system on\nwhich the executable runs, unless that component itself accompanies\nthe executable.\n</p>\n<p>\n  It may happen that this requirement contradicts the license\nrestrictions of other proprietary libraries that do not normally\naccompany the operating system.  Such a contradiction means you cannot\nuse both them and the Library together in an executable that you\ndistribute.\n</p>\n<p>\n<strong>7.</strong> You may place library facilities that are a work\nbased on the Library side-by-side in a single library together with\nother library facilities not covered by this License, and distribute\nsuch a combined library, provided that the separate distribution of\nthe work based on the Library and of the other library facilities is\notherwise permitted, and provided that you do these two things:\n</p>\n\n<ul>\n    <li><strong>a)</strong> Accompany the combined library with a copy\n    of the same work based on the Library, uncombined with any other\n    library facilities.  This must be distributed under the terms of\n    the Sections above.</li>\n\n    <li><strong>b)</strong> Give prominent notice with the combined\n    library of the fact that part of it is a work based on the\n    Library, and explaining where to find the accompanying uncombined\n    form of the same work.</li>\n</ul>\n\n<p>\n<strong>8.</strong> You may not copy, modify, sublicense, link with,\nor distribute the Library except as expressly provided under this\nLicense.  Any attempt otherwise to copy, modify, sublicense, link\nwith, or distribute the Library is void, and will automatically\nterminate your rights under this License.  However, parties who have\nreceived copies, or rights, from you under this License will not have\ntheir licenses terminated so long as such parties remain in full\ncompliance.\n</p>\n<p>\n<strong>9.</strong>\nYou are not required to accept this License, since you have not\nsigned it.  However, nothing else grants you permission to modify or\ndistribute the Library or its derivative works.  These actions are\nprohibited by law if you do not accept this License.  Therefore, by\nmodifying or distributing the Library (or any work based on the\nLibrary), you indicate your acceptance of this License to do so, and\nall its terms and conditions for copying, distributing or modifying\nthe Library or works based on it.\n</p>\n<p>\n<strong>10.</strong>\nEach time you redistribute the Library (or any work based on the\nLibrary), the recipient automatically receives a license from the\noriginal licensor to copy, distribute, link with or modify the Library\nsubject to these terms and conditions.  You may not impose any further\nrestrictions on the recipients' exercise of the rights granted herein.\nYou are not responsible for enforcing compliance by third parties with\nthis License.\n</p>\n<p>\n<strong>11.</strong>\nIf, as a consequence of a court judgment or allegation of patent\ninfringement or for any other reason (not limited to patent issues),\nconditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot\ndistribute so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you\nmay not distribute the Library at all.  For example, if a patent\nlicense would not permit royalty-free redistribution of the Library by\nall those who receive copies directly or indirectly through you, then\nthe only way you could satisfy both it and this License would be to\nrefrain entirely from distribution of the Library.\n</p>\n<p>\nIf any portion of this section is held invalid or unenforceable under any\nparticular circumstance, the balance of the section is intended to apply,\nand the section as a whole is intended to apply in other circumstances.\n</p>\n<p>\nIt is not the purpose of this section to induce you to infringe any\npatents or other property right claims or to contest validity of any\nsuch claims; this section has the sole purpose of protecting the\nintegrity of the free software distribution system which is\nimplemented by public license practices.  Many people have made\ngenerous contributions to the wide range of software distributed\nthrough that system in reliance on consistent application of that\nsystem; it is up to the author/donor to decide if he or she is willing\nto distribute software through any other system and a licensee cannot\nimpose that choice.\n</p>\n<p>\nThis section is intended to make thoroughly clear what is believed to\nbe a consequence of the rest of this License.\n</p>\n<p>\n<strong>12.</strong>\nIf the distribution and/or use of the Library is restricted in\ncertain countries either by patents or by copyrighted interfaces, the\noriginal copyright holder who places the Library under this License may add\nan explicit geographical distribution limitation excluding those countries,\nso that distribution is permitted only in or among countries not thus\nexcluded.  In such case, this License incorporates the limitation as if\nwritten in the body of this License.\n</p>\n<p>\n<strong>13.</strong>\nThe Free Software Foundation may publish revised and/or new\nversions of the Lesser General Public License from time to time.\nSuch new versions will be similar in spirit to the present version,\nbut may differ in detail to address new problems or concerns.\n</p>\n<p>\nEach version is given a distinguishing version number.  If the Library\nspecifies a version number of this License which applies to it and\n\"any later version\", you have the option of following the terms and\nconditions either of that version or of any later version published by\nthe Free Software Foundation.  If the Library does not specify a\nlicense version number, you may choose any version ever published by\nthe Free Software Foundation.\n</p>\n<p>\n<strong>14.</strong>\nIf you wish to incorporate parts of the Library into other free\nprograms whose distribution conditions are incompatible with these,\nwrite to the author to ask for permission.  For software which is\ncopyrighted by the Free Software Foundation, write to the Free\nSoftware Foundation; we sometimes make exceptions for this.  Our\ndecision will be guided by the two goals of preserving the free status\nof all derivatives of our free software and of promoting the sharing\nand reuse of software generally.\n</p>\n<p>\n<strong>NO WARRANTY</strong>\n</p>\n<p>\n<strong>15.</strong>\nBECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO\nWARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.\nEXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR\nOTHER PARTIES PROVIDE THE LIBRARY \"AS IS\" WITHOUT WARRANTY OF ANY\nKIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE\nLIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME\nTHE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n</p>\n<p>\n<strong>16.</strong>\nIN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN\nWRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY\nAND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU\nFOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR\nCONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE\nLIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING\nRENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A\nFAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF\nSUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH\nDAMAGES.\n</p>\n\n<h3>END OF TERMS AND CONDITIONS</h3>\n\n<h3><a id=\"SEC4\">How to Apply These Terms to Your New\nLibraries</a></h3>\n<p>\n  If you develop a new library, and you want it to be of the greatest\npossible use to the public, we recommend making it free software that\neveryone can redistribute and change.  You can do so by permitting\nredistribution under these terms (or, alternatively, under the terms of the\nordinary General Public License).\n</p>\n<p>\n  To apply these terms, attach the following notices to the library.  It is\nsafest to attach them to the start of each source file to most effectively\nconvey the exclusion of warranty; and each file should have at least the\n\"copyright\" line and a pointer to where the full notice is found.\n</p>\n\n<pre><var>one line to give the library's name and an idea of what it does.</var>\nCopyright (C) <var>year</var>  <var>name of author</var>\n\nThis library is free software; you can redistribute it and/or\nmodify it under the terms of the GNU Lesser General Public\nLicense as published by the Free Software Foundation; either\nversion 2.1 of the License, or (at your option) any later version.\n\nThis library is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\nLesser General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public\nLicense along with this library; if not, write to the Free Software\nFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n</pre>\n\n<p>\nAlso add information on how to contact you by electronic and paper mail.\n</p>\n<p>\nYou should also get your employer (if you work as a programmer) or your\nschool, if any, to sign a \"copyright disclaimer\" for the library, if\nnecessary.  Here is a sample; alter the names:\n</p>\n\n<pre>Yoyodyne, Inc., hereby disclaims all copyright interest in\nthe library `Frob' (a library for tweaking knobs) written\nby James Random Hacker.\n\n<var>signature of Ty Coon</var>, 1 April 1990\nTy Coon, President of Vice\n</pre>\n\n<p>\nThat's all there is to it!</p>\n\n\n</body></html>"
  },
  {
    "path": "Makefile",
    "content": "##############################################################################\n# Dynamic Audio Normalizer\n# Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version, but always including the *additional*\n# restrictions defined in the \"License.txt\" file.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License along\n# with this program; if not, write to the Free Software Foundation, Inc.,\n# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n#\n# http://www.gnu.org/licenses/gpl-2.0.txt\n##############################################################################\n\nECHO=echo -e\nSHELL=/bin/bash\n\nMODE ?= full\nPANDOC ?= pandoc\n\n##############################################################################\n# Constants\n##############################################################################\n\nLIBRARY_NAME := DynamicAudioNormalizerAPI\nPROGRAM_NAME := DynamicAudioNormalizerCLI\nLOGVIEW_NAME := DynamicAudioNormalizerGUI\nJNIWRAP_NAME := DynamicAudioNormalizerJNI\nPYDWRAP_NAME := DynamicAudioNormalizerPYD\nPASWRAP_NAME := DynamicAudioNormalizerPAS\nBUILD_DATE   := $(shell date +%Y-%m-%d)\nBUILD_TIME   := $(shell date +%H:%M:%S)\nBUILD_TAG    := $(addprefix /tmp/,$(shell echo $$RANDOM$$RANDOM$$RANDOM))\nTARGET_PATH  := ./bin/$(BUILD_DATE)\nOUTPUT_FILE  := $(abspath ./bin/DynamicAudioNormalizer.$(BUILD_DATE).tbz2)\nPANDOC_FLAGS := markdown_github+pandoc_title_block+header_attributes+implicit_figures\nJARS_PATH    := tmp/jars\n\n# Version info\nVER_MAJOR = $(shell sed -n 's/.*DYNAUDNORM_NS::VERSION_MAJOR\\s*=\\s*\\([0-9]*\\).*/\\1/p' < ./DynamicAudioNormalizerAPI/src/Version.cpp)\nVER_MINOR = $(shell sed -n 's/.*DYNAUDNORM_NS::VERSION_MINOR\\s*=\\s*\\([0-9]*\\).*/\\1/p' < ./DynamicAudioNormalizerAPI/src/Version.cpp)\nVER_PATCH = $(shell sed -n 's/.*DYNAUDNORM_NS::VERSION_PATCH\\s*=\\s*\\([0-9]*\\).*/\\1/p' < ./DynamicAudioNormalizerAPI/src/Version.cpp)\n\n# API Version\nexport API_VERSION := $(shell sed -n 's/.*define MDYNAMICAUDIONORMALIZER_CORE \\([0-9]*\\).*/\\1/p' < ./DynamicAudioNormalizerAPI/include/DynamicAudioNormalizer.h)\n\n##############################################################################\n# Projects\n##############################################################################\n\nMY_PROJECTS := NONE\n\nifeq ($(MODE),full)\n  MY_PROJECTS := API CLI GUI JNI PYD\n  export ENABLE_JNI := true\nendif\nifeq ($(MODE),no-gui)\n  MY_PROJECTS := API CLI JNI PYD\n  export ENABLE_JNI := true\nendif\nifeq ($(MODE),minimal)\n  MY_PROJECTS := API CLI\n  export ENABLE_JNI := false\nendif\n\nifeq ($(MY_PROJECTS),NONE)\n  $(error Invalid MODE value: $(MODE))\nendif\n\n##############################################################################\n# Rules\n##############################################################################\n\nBUILD_PROJECTS = $(addprefix DynamicAudioNormalizer,$(MY_PROJECTS))\nCLEAN_PROJECTS = $(addprefix CleanUp,$(BUILD_PROJECTS))\n\n.PHONY: all clean $(BUILD_PROJECTS) $(CLEAN_PROJECTS) DeployBinaries CopyAllBinaries CreateDocuments CreateTagFile\n\nall: $(BUILD_PROJECTS) DeployBinaries\n\t@$(ECHO) \"\\n\\e[1;32mComplete.\\e[0m\\n\"\n\nclean: $(CLEAN_PROJECTS) CleanBinaries\n\t@$(ECHO) \"\\n\\e[1;32mComplete.\\e[0m\\n\"\n\n#-------------------------------------------------------------\n# Clean\n#-------------------------------------------------------------\n\n$(CLEAN_PROJECTS):\n\t@$(ECHO) \"\\n\\e[1;31m-----------------------------------------------------------------------------\\e[0m\"\n\t@$(ECHO) \"\\e[1;31mClean: $(patsubst Clean%,%,$@)\\e[0m\"\n\t@$(ECHO) \"\\e[1;31m-----------------------------------------------------------------------------\\n\\e[0m\"\n\tmake -C ./$(patsubst CleanUp%,%,$@) clean\n\nCleanBinaries:\n\t@$(ECHO) \"\\n\\e[1;31m-----------------------------------------------------------------------------\\e[0m\"\n\t@$(ECHO) \"\\e[1;31mClean\\e[0m\"\n\t@$(ECHO) \"\\e[1;31m-----------------------------------------------------------------------------\\n\\e[0m\"\n\trm -rfv ./bin\n\n#-------------------------------------------------------------\n# Build\n#-------------------------------------------------------------\n\n$(BUILD_PROJECTS):\n\t@$(ECHO) \"\\n\\e[1;34m-----------------------------------------------------------------------------\\e[0m\"\n\t@$(ECHO) \"\\e[1;34mBuild: $@\\e[0m\"\n\t@$(ECHO) \"\\e[1;34m-----------------------------------------------------------------------------\\n\\e[0m\"\n\tmake -C ./$@\n\n#-------------------------------------------------------------\n# Deploy\n#-------------------------------------------------------------\n\nDeployBinaries: CopyAllBinaries CreateDocuments CreateTagFile\n\t@$(ECHO) \"\\n\\e[1;34m-----------------------------------------------------------------------------\\e[0m\"\n\t@$(ECHO) \"\\e[1;34mDeploy\\e[0m\"\n\t@$(ECHO) \"\\e[1;34m-----------------------------------------------------------------------------\\n\\e[0m\"\n\trm -f $(OUTPUT_FILE)\n\tpushd $(TARGET_PATH) ; tar -vcjf $(OUTPUT_FILE) * ; popd\n\nCreateTagFile:\n\t@$(ECHO) \"\\n\\e[1;34m-----------------------------------------------------------------------------\\e[0m\"\n\t@$(ECHO) \"\\e[1;34mBuild Tag\\e[0m\"\n\t@$(ECHO) \"\\e[1;34m-----------------------------------------------------------------------------\\n\\e[0m\"\n\techo \"Dynamic Audio Normalizer\" > $(BUILD_TAG)\n\techo \"Copyright (C) 2014-$(shell date +%Y) LoRd_MuldeR <MuldeR2@GMX.de>. Some rights reserved.\" >> $(BUILD_TAG)\n\techo \"\" >> $(BUILD_TAG)\n\techo \"Version $$(printf %d.%02d-%d $(VER_MAJOR) $(VER_MINOR) $(VER_PATCH)). Built on $(BUILD_DATE), at $(BUILD_TIME)\" >> $(BUILD_TAG)\n\techo \"\" >> $(BUILD_TAG)\n\tg++ --version | head -n1 | sed 's/^/Compiler version:   /' >> $(BUILD_TAG)\nifeq ($(shell uname), Darwin)\n\tuname -v | sed 's/^/Build platform:     /' >> $(BUILD_TAG)\n\techo \"System description: Darwin\" >> $(BUILD_TAG)\nelse\n\tuname -srmo | sed 's/^/Build platform:     /' >> $(BUILD_TAG)\n\t(lsb_release -s -d || ([ -n \"$$MSYSTEM\" ] && echo \"$$MSYSTEM\") || echo \"Unknown\") | sed 's/\\\"//g' | sed 's/^/System description: /' >> $(BUILD_TAG)\nendif\n\techo \"\" >> $(BUILD_TAG)\n\techo \"This library is free software; you can redistribute it and/or\" >> $(BUILD_TAG)\n\techo \"modify it under the terms of the GNU Lesser General Public\" >> $(BUILD_TAG)\n\techo \"License as published by the Free Software Foundation; either\" >> $(BUILD_TAG)\n\techo \"version 2.1 of the License, or (at your option) any later version.\" >> $(BUILD_TAG)\n\techo \"\" >> $(BUILD_TAG)\n\techo \"This library is distributed in the hope that it will be useful,\" >> $(BUILD_TAG)\n\techo \"but WITHOUT ANY WARRANTY; without even the implied warranty of\" >> $(BUILD_TAG)\n\techo \"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\" >> $(BUILD_TAG)\n\techo \"Lesser General Public License for more details.\" >> $(BUILD_TAG)\n\tmkdir -p $(TARGET_PATH)\n\tmv -f $(BUILD_TAG) $(TARGET_PATH)/BUILD_TAG\n\nCopyAllBinaries:\n\t@$(ECHO) \"\\n\\e[1;34m-----------------------------------------------------------------------------\\e[0m\"\n\t@$(ECHO) \"\\e[1;34mCopy Binaries\\e[0m\"\n\t@$(ECHO) \"\\e[1;34m-----------------------------------------------------------------------------\\n\\e[0m\"\n\trm -rf $(TARGET_PATH)\n\tmkdir -p $(TARGET_PATH)/include\n\tmkdir -p $(TARGET_PATH)/samples/java\n\tmkdir -p $(TARGET_PATH)/samples/python\n\tmkdir -p $(TARGET_PATH)/samples/pascal\n\tcp $(PROGRAM_NAME)/bin/$(PROGRAM_NAME).* $(TARGET_PATH)\n\tcp $(LIBRARY_NAME)/lib/lib$(LIBRARY_NAME)-$(API_VERSION).* $(TARGET_PATH)\n\tcp $(LOGVIEW_NAME)/bin/$(LOGVIEW_NAME).* $(TARGET_PATH) || $(ECHO) \"\\e[1;33mWARNING: File \\\"$(LOGVIEW_NAME)\\\" not found!\\e[0m\"\n\tcp $(JNIWRAP_NAME)/out/$(JNIWRAP_NAME).jar $(TARGET_PATH) || $(ECHO) \"\\e[1;33mWARNING: File \\\"$(JNIWRAP_NAME).jar\\\" not found!\\e[0m\"\n\tcp $(PYDWRAP_NAME)/lib/$(PYDWRAP_NAME).so $(TARGET_PATH) || $(ECHO) \"\\e[1;33mWARNING: File \\\"$(PYDWRAP_NAME).so\\\" not found!\\e[0m\"\n\tcp $(LIBRARY_NAME)/include/*.h $(TARGET_PATH)/include\n\tcp $(PYDWRAP_NAME)/include/*.py $(TARGET_PATH)/include\n\tcp $(PASWRAP_NAME)/include/*.pas $(TARGET_PATH)/include\n\tcp $(JNIWRAP_NAME)/samples/com/muldersoft/dynaudnorm/samples/*.java $(TARGET_PATH)/samples/java\n\tcp $(PYDWRAP_NAME)/samples/*.py $(TARGET_PATH)/samples/python\n\tcp $(PASWRAP_NAME)/src/*.pas $(TARGET_PATH)/samples/pascal\n\tcp $(PASWRAP_NAME)/src/*.dfm $(TARGET_PATH)/samples/pascal\n\tcp ./LICENSE-*.html $(TARGET_PATH)\n\nCreateDocuments:\n\t@$(ECHO) \"\\n\\e[1;34m-----------------------------------------------------------------------------\\e[0m\"\n\t@$(ECHO) \"\\e[1;34mCreate Documents\\e[0m\"\n\t@$(ECHO) \"\\e[1;34m-----------------------------------------------------------------------------\\n\\e[0m\"\n\twget -N -P $(JARS_PATH) https://repo1.maven.org/maven2/com/yahoo/platform/yui/yuicompressor/2.4.8/yuicompressor-2.4.8.jar\n\twget -N -P $(JARS_PATH) https://repo1.maven.org/maven2/com/googlecode/htmlcompressor/htmlcompressor/1.5.2/htmlcompressor-1.5.2.jar\n\tmkdir -p $(TARGET_PATH)/img/dyauno\n\t$(PANDOC) --from $(PANDOC_FLAGS) --to html5 --toc -N --standalone -H ./img/dyauno/Style.inc ./README.md | java -jar $(JARS_PATH)/htmlcompressor-1.5.2.jar --compress-css -o $(TARGET_PATH)/README.html\n\ttest -s $(TARGET_PATH)/README.html || (rm -f $(TARGET_PATH)/README.html; cp ./README.md $(TARGET_PATH)/README.md)\n\tcp ./img/dyauno/*.png $(TARGET_PATH)/img/dyauno\n\n"
  },
  {
    "path": "README.md",
    "content": "% ![](img/dyauno/DynAudNorm.png)  \nDynamic Audio Normalizer\n% by LoRd_MuldeR &lt;<mulder2@gmx>&gt; | <http://muldersoft.com/>\n\n# Introduction #\n\n**&#9733; *Free/libre software · This software is provided 100% free of charge · No adware or spyware!* &#9733;**\n\n**Dynamic Audio Normalizer** is a library for *advanced* [audio normalization](http://en.wikipedia.org/wiki/Audio_normalization) purposes. It applies a certain amount of gain to the input audio in order to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in contrast to more \"simple\" normalization algorithms, the Dynamic Audio Normalizer *dynamically* re-adjusts the gain factor to the input audio. This allows for applying extra gain to the \"quiet\" sections of the audio while avoiding distortions or clipping the \"loud\" sections. In other words: The Dynamic Audio Normalizer will \"even out\" the volume of quiet and loud sections, in the sense that the volume of each section is brought to the same target level. Note, however, that the Dynamic Audio Normalizer achieves this goal *without* applying \"dynamic range compressing\". It will retain 100% of the dynamic range *within* each \"local\" region of the audio file.\n\nThe *Dynamic Audio Normalizer* is available as a small standalone [command-line](http://en.wikipedia.org/wiki/Command-line_interface) utility and also as an effect in the [SoX](http://sox.sourceforge.net/) audio processor as well as in the [FFmpeg](https://ffmpeg.org/) audio/video converter. Furthermore, it can be integrated into your favourite DAW (digital audio workstation), as a [VST](http://de.wikipedia.org/wiki/Virtual_Studio_Technology) plug-in, or into your favourite media player, as a [Winamp](http://www.winamp.com/) plug-in. Last but not least, the \"core\" library can be integrated into custom applications easily, thanks to a straightforward [API](http://en.wikipedia.org/wiki/Application_programming_interface) (application programming interface). The \"native\" API is written in *C++*, but language [bindings](http://en.wikipedia.org/wiki/Language_binding) for *C99*, *Microsoft.NET*, *Java*, *Python* and *Pascal* are provided.\n\n\n# How It Works #\n\nA \"standard\" (non-dynamic) audio normalization algorithm applies the same *constant* amount of gain to *all* samples in the file. Consequently, the gain factor must be chosen in a way that won't cause clipping (distortion), even for the input sample that has the highest magnitude. So if `S_max` denotes the highest magnitude sample in the *whole* input audio and ``Peak`` is the desired peak magnitude, then the gain factor will be chosen as `G=Peak/abs(S_max)`. This works fine, as long as the volume of the input audio is constant, more or less. If, however, the volume of the input audio varies significantly over time – as is the case with many \"real world\" recordings – the standard normalization algorithm will *not* give satisfying result. That's because the \"loud\" parts can *not* be amplified any further (without distortions) and thus the \"quiet\" parts will remain quiet too.\n\n**Dynamic Audio Normalizer** solves this problem by processing the input audio in small chunks, referred to as *frames*. A frame typically has a length 500 milliseconds, but the frame size can be adjusted as needed. The Dynamic Audio Normalizer then finds the highest magnitude sample *within* each frame, individually and independently. Next, it computes the maximum possible gain factor (without distortions) for each individual frame. So, if ``S_max[n]`` denotes the highest magnitude sample within the *n*-th frame, then the maximum possible gain factor for the *n*-th frame will be `G[n]=Peak/abs(S_max[n])`. Unfortunately, simply amplifying each frame with its own \"local\" maximum gain factor `G[n]` would **not** produce a satisfying overall result either. That's because the maximum gain factors can vary *strongly* and *unsteadily* between neighboring frames! Therefore, applying the maximum possible gain to each frame *without* taking neighboring frames into account would result in a strong *dynamic range compression* – which not only has a tendency to destroy the \"vividness\" of the audio but could also result in the \"pumping\" effect, i.e fast changes of the gain factor that become clearly noticeable to the listener.\n\n\n## Dynamic Normalization Algorithm ##\n\nThe Dynamic Audio Normalizer tries to avoid these issues by applying an advanced *dynamic* normalization algorithm. Essentially, when processing a particular frame, it also takes into account a certain *neighborhood* around the current frame, i.e. the frames *preceding* and *succeeding* the current frame will be considered as well. However, while information about \"past\" frames can simply be stored as long as they are needed, information about \"future\" frames are *not* normally available. A simple approach to solve this issue would be using a *2-Pass* algorithm, but this would require processing the entire audio file *twice* – which also makes stream processing impossible. The Dynamic Audio Normalizer uses a different approach instead: It employs a tall \"look ahead\" buffer. This means that that all audio frames will progress trough an internal [*FIFO*](http://en.wikipedia.org/wiki/FIFO) (first in, first out) buffer. The size of this buffer is chosen sufficiently large, so that a frame's *complete* neighborhood, including the *subsequent* frames, will already be present in the buffer when *that* particular frame is being processed. The \"look ahead\" buffer eliminates the need for 2-Pass processing and thus gives an improved performance. It also makes stream processing possible.\n\nWith information about the frame's neighborhood available, a [*Gaussian* smoothing kernel](http://en.wikipedia.org/wiki/Gaussian_blur) can be applied on those gain factors. Put simply, this smoothing filter \"mixes\" the gain factor of the ``n``-th frames with those of its *preceding* frames (`n-1`, `n-2`, &hellip;) as well as with its *subsequent* frames (`n+1`, `n+2`, …) – where \"nearby\" frames have a stronger influence (weight), while \"distant\" frames have a declining influence. This way, abrupt changes of the gain factor are avoided and, instead, we get *smooth transitions* of the gain factor over time. Furthermore, since the filter also takes into account *future* frames, Dynamic Audio Normalizer avoids applying strong gain to \"quiet\" frames located shortly before \"loud\" frames. In other words, Dynamic Audio Normalizer adjusts the gain factor *early* and thus nicely prevents distortions or abrupt gain changes.\n\nOne more challenge to consider is that applying the Gaussian smoothing kernel alone can *not* solve all problems. That's because the smoothing kernel will *not* only smoothen *increasing* gain factors but also *declining* ones! If, for example, a very \"loud\" frame follows immediately after a sequence of \"quiet\" frames, the smoothing causes the gain factor to decrease early but slowly. As a result, the *filtered* gain factor of the \"loud\" frame could actually turn out to be *higher* than its (local) maximum gain factor – which results in distortion, if not taken care of! For this reason, the Dynamic Audio Normalizer *additionally* applies a \"minimum\" filter, i.e. a filter that replaces each gain factor with the *smallest* value within the neighborhood. This is done *before* the Gaussian smoothing kernel in order to ensure that all gain transitions will remain smooth.\n\nThe following example shows the results from a \"real world\" audio recording that has been processed by the Dynamic Audio Normalizer algorithm. The chart shows the maximum local gain factors for each individual frame (blue) as well as the minimum filtered gain factors (green) and the *final* smoothened gain factors (orange). Note the very \"smooth\" progression of the final gain factors. At the same time, the maximum local gain factors are approached as closely as possible. Last but not least note that the smoothened gain factors *never* exceed the maximum local gain factor, which prevents distortions.\n\n![Progression of the gain factors for each audio frame](img/dyauno/Chart.png)\n\n\n## Intra-Frame Normalization ##\n\nSo far it has been discussed how the \"optimal\" gain factor for each frame is determined. However, since each frame contains a large number of samples – at a typical sampling rate of 44,100 Hz and a standard frame size of 500 milliseconds we have 22,050 samples per frame – it is also required to infer the gain factor for each individual sample *within* the frame. The most simple approach, of course, would be applying the *same* gain factor to *all* samples in a certain frame. But this would also lead to abrupt changes of the gain factor at each frame boundary, while the gain factor remains completely constant within the frames. A better approach, as implemented in the Dynamic Audio Normalizer, is *interpolating* the per-sample gain factors. In particular, the Dynamic Audio Normalizer applies a straight-forward *linear interpolation*, which is used to compute the gain factors for the samples of the `n`-th frame from the gain factors `G'[n-1]`, `G'[n]` and `G'[n+1]` – where `G'[k]` denotes the gain factor of the `k`-th frame. The following graph shows how the per-sample gain factors (orange) are interpolated from the gain factors of the *preceding* (`G'[n-1]`, green), *current* (`G'[n]`, blue) and *subsequent* (`G'[n+1]`, purple) frame.\n\n![Linear interpolation of the per-sample gain factors](img/dyauno/Interpolation.png)\n\n\n## Real World Results (Example) ##\n\nFinally, the following waveform view illustrates how the volume of a \"real world\" audio recording has been harmonized by the Dynamic Audio Normalizer. The upper graph shows the unprocessed original recording while the lower graph shows the output as created by the Dynamic Audio Normalizer. As can be seen, the significant volume variation between the \"loud\" and the \"quiet\" parts that existed in the original recording has been rectified – to a great extent – while the dynamics within each section of the input have been retained. Also, there is absolutely **no** clipping or distortion in the \"loud\" sections.\n\n![Waveform *before* (top) and *after* (bottom) processing with the Dynamic Audio Normalizer](img/dyauno/Waveform.png)\n\n\n\n# Download & Installation #\n\nDynamic Audio Normalizer can be downloaded from one of the following *official* mirror sites:\n* https://github.com/lordmulder/DynamicAudioNormalizer/releases/latest\n* https://bitbucket.org/muldersoft/dynamic-audio-normalizer/downloads\n* https://sourceforge.net/projects/muldersoft/files/Dynamic%20Audio%20Normalizer/\n* https://www.mediafire.com/folder/flrb14nitnh8i/Dynamic_Audio_Normalizer\n* https://www.assembla.com/spaces/dynamicaudionormalizer/documents\n\n**Note:** Windows binaries are provided in the compressed *ZIP* format. Simply use [7-Zip](http://www.7-zip.org/) or a similar tool to unzip *all* files to new/empty directory. If in doubt, Windows users should download the \"static\" version. That's it!\n\n\n## System Requirements ##\n\nThe Dynamic Audio Normalizer \"core\" library and CLI front-end are written in plain C++11 and therefore do **not** have any system requirements, except for a conforming C++ compiler. Currently, the Microsoft Visual C++ compiler and the GNU Compiler Collection (GCC) are actively supported. Other compilers should work too, but this cannot be guaranteed.\n\n*Pre-compiled* binaries are provided for the *Windows* and *GNU/Linux* platforms. The 32-Bit Windows binaries should work on Windows XP (with Service Pack 2) or any later version (32-Bit or 64-Bit), while the 64-Bit Windows binaries require the \"x64\" edition of Windows Vista or any later 64-Bit Windows. Linux binaries are provided for some popular distributions (latest \"Long Term Support\" version at the time of release). Those Linux binaries *may* work on other distributions too, or not. Therefore, Linux users are generally recommended to compile the Dynamic Audio Normalizer themselves, from the source codes.\n\nAll *pre-compiled* binaries have been optimized for processors that support *at least* the [*SSE2*](https://en.wikipedia.org/wiki/SSE2) instruction set, so an SSE2-enabled processor (Pentium 4, Athlon 64, or later) is required. For *legacy* processors you will need to compile Dynamic Audio Normalizer and all the third-party libraries *yourself*, from the sources &ndash; with appropriate compiler settings.\n\n\n## Dependencies\n\nThe Dynamic Audio Normalizer depends on some *third-party* libraries. Those libraries need to be present at runtime! How to obtain the required *third-party* libraries, if not already installed, depends on the operating system.\n\n### Windows\n\nFor the *Windows* platform, the release packages already contain *all* required third-party libraries. We provide separate **Static** and **DLL** packages though. The \"Static\" binaries have all the required libraries *built-in* (including third-party libraries and C-Runtime) and thus they do *not* depend on any separate DLL files. At the same time, the \"DLL\" package contains separate DLL files for the Dynamic Audio Normalizer \"core\" library as well as for the required third-party libraries and the C-Runtime. If you don't understand what this means, then simply go with the \"Static\" version. If you are a programmer and you want to invoke the Dynamic Audio Normalizer \"core\" library from your own program, then you need to go with the \"DLL\" version.\n\n### Linux\n\nFor the *Linux* platform, the release packages do ***not*** contain any third-party libraries. That's because, on Linux, it is highly recommended to install those libraries via the *package manager*. Usually, most of the required third-party libraries will already be installed on your Linux-based system, but some may need to be installed explicitly. The details depend on the particular Linux distribution and on the particular package manager. We give examples for [*Ubuntu*](https://www.ubuntu.com/), [*openSUSE*](https://www.opensuse.org/) and [*CentOS*](https://www.centos.org/) here:\n\n* **Ubuntu 16.04 LTS**:\n```\nsudo apt install libsndfile1 libmpg123-0 libqtgui4\n```\n\n* **openSUSE Leap 42.2**:\n```\nsudo zypper addrepo \\\n  http://download.opensuse.org/repositories/multimedia:libs/openSUSE_Leap_42.2/multimedia:libs.repo\nsudo zypper refresh\nsudo zypper install libsndfile1 libmpg123-0 libqt4-x11\n```\n\n* **CentOS/RHEL 7.3**:\n```\nsudo yum -y install epel-release\nsudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm\nsudo yum install libsndfile libmpg123 qt-x11\n```\n\n**Note:** There are some additional *indirect* dependencies that will be resolved automatically by the package manager.\n\n### Mac OS X\n\nThere is preliminary support for building on Mac OS X:\n\n```\nbrew cask install java\nbrew install python3\nbrew install libsndfile mpg123\nbrew install ant pandoc wget\nexport JAVA_HOME=$(/usr/libexec/java_home)\nmake MODE=no-gui\n```\n\n## Package Contents ##\n\nThe following files are included in the Dynamic Audio Normalizer release package (Windows, \"DLL\" version):\n\n\tapi-ms-win-*                  - Microsoft Universal CRT redistributable\n\tDynamicAudioNormalizer.h      - Header file for the Dynamic Audio Normalizer library\n\tDynamicAudioNormalizer.pas    - Pascal wrapper for the Dynamic Audio Normalizer library\n\tDynamicAudioNormalizerAPI.dll - Dynamic Audio Normalizer core library (shared)\n\tDynamicAudioNormalizerAPI.lib - Import library for the Dynamic Audio Normalizer library\n\tDynamicAudioNormalizerCLI.exe - Dynamic Audio Normalizer command-line application\n\tDynamicAudioNormalizerGUI.exe - Dynamic Audio Normalizer log viewer application\n\tDynamicAudioNormalizerJNI.jar - Java wrapper for the Dynamic Audio Normalizer library\n\tDynamicAudioNormalizerNET.dll - .NET wrapper for the Dynamic Audio Normalizer library\n\tDynamicAudioNormalizerSoX.exe - SoX binary with included Dynamic Audio Normalizer effect\n\tDynamicAudioNormalizerVST.dll - Dynamic Audio Normalizer VST wrapper library\n\tlibmpg123.dll                 - libmpg123 library, used for reading MPEG audio files\n\tlibsndfile-1.dll              - libsndfile library, used for reading/writing audio files\n\tmsvcp140.dll                  - Visual C++ 2015 runtime library redistributable\n\tpthreadVC2.dll                - POSIX threading library, used for thread management\n\tQtCore4.dll                   - Qt library, used to create the graphical user interfaces\n\tQtGui4.dll                    - Qt library, used to create the graphical user interfaces\n\tREADME.html                   - The README file\n\tucrtbase.dll                  - Microsoft Universal CRT redistributable\n\tvcruntime140.dll              - Visual C++ 2015 runtime library redistributable\n\n\n**Note:** Standard binaries are *32-Bit* (x86), though *64-Bit* (AMD64/EM64T) versions can be found in the `x64` sub-folder.\n\n\n\n# Command-Line Usage #\n\nThe Dynamic Audio Normalizer *standalone* program can be invoked via [command-line interface](http://en.wikipedia.org/wiki/Command-line_interface) (CLI), which can be done either *manually* from the [command prompt](http://en.wikipedia.org/wiki/Command_Prompt) or *automatically* (scripted), e.g. by using a [batch](http://en.wikipedia.org/wiki/Batch_file) file.\n\n\n## Basic Command-Line Syntax ##\n\nThe basic Dynamic Audio Normalizer command-line syntax is as follows:  \n```\nDynamicAudioNormalizerCLI.exe -i <;input_file> -o <output_file> [options]\n```\n\nNote that the *input* file (option `-i` or `--input`) and the *output* file (option `-o` or `--output`) always have to be specified, while all other parameters are optional. But take care, an existing output file will be *overwritten* silently!\n\nAlso note that the Dynamic Audio Normalizer uses [libsndfile](http://www.mega-nerd.com/libsndfile/) for input/output, so a wide range of file formats (WAV, W64, FLAC, Ogg/Vorbis, AIFF, AU/SND, etc) as well as various sample types (ranging from 8-Bit INT to 64-Bit FP) are supported. However, *libsndfile* can **not** read MP2 (MPEG Audio Layer II) or MP3 (MPEG Audio Layer III) files, so [libmpg123](https://www.mpg123.de/) will be used for reading files that \"look\" like MP2 or MP3 data. You can specify `-d` option to select the desired decoder library explicitly.\n\nBy default, the Dynamic Audio Normalizer program will *guess* the output file format from the file extension of the specified output file. This can be overwritten by using the `-t` option. To create a FLAC file, e.g., you can specify `-t flac`.\n\nPassing \"raw\" PCM data via [pipe](http://en.wikipedia.org/wiki/Pipeline_%28Unix%29) is supported. Specify the file name ``\"-\"`` in order to read from or write to the [stdin](http://en.wikipedia.org/wiki/Standard_streams) or [stdout](http://en.wikipedia.org/wiki/Standard_streams), respectively. When reading from the *stdin*, you have to specify the *input* sample format, channel count and sampling rate!\n\nFor a list of *all* available options, see the [list below](#command-line-options) or run ``DynamicAudioNormalizerCLI.exe --help`` from the command prompt. Also, refer to the [**configuration**](#configuration) chapter for more details on the Dynamic Audio Normalizer parameters!\n\n\n## Command-Line Options\n\nThe following Dynamic Audio Normalizer command-line options are available:  \n\n* **Input/Output:**  \n```\n-i --input <file>        Input audio file [required]\n-d --input-lib <value>   Input decoder library [default: auto-detect]\n-o --output <file>       Output audio file [required]\n-t --output-fmt <value>  Output format [default: auto-detect]\n-u --output-bps <value>  Output bits per sample [default: like input]\n```\n\n* **Algorithm Tweaks:**  \n```\n-f --frame-len <value>   Frame length, in milliseconds [default: 500]\n-g --gauss-size <value>  Gauss filter size, in frames [default: 31]\n-p --peak <value>        Target peak magnitude, 0.1-1 [default: 0.95]\n-m --max-gain <value>    Maximum gain factor [default: 10.00]\n-r --target-rms <value>  Target RMS value [default: 0.00]\n-n --no-coupling         Disable channel coupling [default: on]\n-c --correct-dc          Enable the DC bias correction [default: off]\n-b --alt-boundary        Use alternative boundary mode [default: off]\n-s --compress <value>    Compress the input data [default: 0.00]\n```\n\n* **Diagnostics:**  \n```\n-v --verbose             Output additional diagnostic info\n-l --log-file <file>     Create a log file\n-h --help                Print *this* help screen\n```\n\n* **Raw Data Options:**  \n```\n--input-bits <value>     Bits per sample, e.g. '16' or '32'\n--input-chan <value>     Number of channels, e.g. '2' for Stereo\n--input-rate <value>     Sample rate in Hertz, e.g. '44100'\n```\n\n\n## Command-Line Usage Examples ##\n\nHere are some examples on how to invoke the Dynamic Audio Normalizer command-line program:\n\n* Read input from Wave file and write output to a Wave file again:  \n```\nDynamicAudioNormalizerCLI.exe -i \"in_original.wav\" -o \"out_normalized.wav\"\n```\n\n* Read input from *stdin* (input is provided by [FFmpeg](http://ffmpeg.org/about.html) via pipe) and write output to Wave file:  \n```\nffmpeg.exe -i \"movie.mkv\" -loglevel quiet -vn -f s16le -c:a pcm_s16le - |\n  DynamicAudioNormalizerCLI.exe -i - --input-bits 16 --input-chan 2 --input-rate 48000 -o \"output.wav\"\n```\n\n* Read input from Wave file and write output to *stdout* (output is passed to [FFmpeg](http://ffmpeg.org/about.html) via pipe):  \n```\nDynamicAudioNormalizerCLI.exe -i \"input.wav\" -o - |\n  ffmpeg.exe -loglevel quiet -f s16le -ar 44100 -ac 2 -i - -c:a libmp3lame -qscale:a 2 \"output.mp3\"\n```\n\n\n\n# SoX/FFmpeg Usage\n\nThe Dynamic Audio Normalizer library is *integrated* in the **SoX** and **FFmpeg** command-line applications!\n\n\n## SoX Integration Usage ##\n\nAs an alternative to the Dynamic Audio Normalizer command-line front-end, the Dynamic Audio Normalizer library may also be used as an effect in [**SoX** (Sound eXchange)](http://sox.sourceforge.net/), a versatile audio editor and converter.\n\nNote, however, that *standard* SoX distributions do **not** currently support the Dynamic Audio Normalizer. Instead, a special *patched* build of SoX that has the Dynamic Audio Normalizer effect enabled is required!\n\nWhen using SoX, the Dynamic Audio Normalizer can be invoked by adding the \"dynaudnorm\" effect to your chain:  \n```\nDynamicAudioNormalizerSoX.exe -S \"in_original.wav\" -o \"out_normalized.wav\" dynaudnorm [options]\n```\n\nFor details about the SoX command-line syntax, please refer to the offical [SoX documentation](http://sox.sourceforge.net/sox.html), or simply type ``--help-effect dynaudnorm`` in order to make SoX print a list of available options.\n\n\n## FFmpeg Integration Usage ##\n\nFurthermore, the Dynamic Audio Normalizer is available as an audio filter in [**FFmpeg**](https://www.ffmpeg.org/), a complete, cross-platform solution to record, convert and stream audio and video. Thanks to *Paul B Mahol* for porting Dynamic Audio Normalizer to FFmpeg.\n\nSince the Dynamic Audio Normalizer has been committed to the official FFmpeg codebase, you can use *any* FFmpeg binary. Just be sure to grab an *up-to-date* FFmpeg that has the \"dynaudnorm\" filter integrated. Windows users can download ready-made FFmpeg binaries [here](http://ffmpeg.zeranoe.com/builds/). Linux users install FFmpeg from the package manager of their distribution or [build](https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu) it themselves. If the FFmpeg included with your distribution is too old, find recent Linux binaries [here](http://johnvansickle.com/ffmpeg/).\n\nWhen using FFmpeg, the Dynamic Audio Normalizer can be invoked by adding the \"dynaudnorm\" filter via `-af` switch:\n```\nffmpeg.exe -i \"in_original.wav\" -af dynaudnorm \"out_normalized.wav\"\n```\n\nFor details about the FFmpeg command-line syntax, please refer to the [FFmpeg documentation](https://ffmpeg.org/ffmpeg-filters.html#dynaudnorm), see the [FFmpeg filtering guide](https://trac.ffmpeg.org/wiki/FilteringGuide), or type ``ffmpeg.exe -h full | more`` for a list of available options.\n\n\n# VST Plug-In Usage #\n\n<small>**VST PlugIn Interface Technology by Steinberg Media Technologies GmbH. VST is a trademark of Steinberg Media Technologies GmbH.**</small>\n\n![VSTLogo](img/dyauno/VSTLogo.png \"VST Logo\")  \n\nThe Dynamic Audio Normalizer is also available in the form of a [**VST** (Virtual Studio Technology) plug-in](http://en.wikipedia.org/wiki/Virtual_Studio_Technology). The VST plug-in interface technology, developed by Steinberg Media Technologies, provides a way of integrating arbitrary audio effects (and instruments) into arbitrary applications – provided that the audio effect is available in the form of a VST plug-in and provided that the application supports \"hosting\" VST plug-ins. An application capable of loading and using VST plug-ins is referred to as a *VST host*. This means that the Dynamic Audio Normalizer can be used as an effect in *any* VST host. Note that VST is widely supported in [DAWs (Digital Audio Workstations)](http://en.wikipedia.org/wiki/Digital_audio_workstation) nowadays, including most of the popular Wave Editors. Therefore, the provided Dynamic Audio Normalizer VST plug-in can be integrated into all of these applications easily. Note that most VST hosts provide a graphical user interface to configure the VST plug-in. The screen capture below shows the Dynamic Audio Normalizer as it appears in the *Acoustica* software by Acon AS. The options exposed by the VST plug-in are identical to those exposed by the [CLI](#command-line-usage) version.\n\n![The Dynamic Audio Normalizer *VST Plug-In* interface (in Acoustica 6.0, Copyright © 2014 Acon AS)](img/dyauno/VSTPlugInConf.png)\n\n\n## Install Instructions ##\n\nThe exact steps that are required to load, activate and configure a VST plug-in differ from application to application. However, it will generally be required to make the application \"recognize\" the new VST plug-in, i.e. ``DynamicAudioNormalizerVST.dll`` first. Most applications will either pick up the VST plug-in from the *global* VST directory – usually located at ``C:\\Program Files (x86)\\Steinberg\\Vstplugins`` on Windows – or provide an option to choose the directory from where to load the VST plug-in. This means that, depending on the individual application, you will either need to copy the Dynamic Audio Normalizer VST plug-in into the *global* VST directory *or* tell the application where the Dynamic Audio Normalizer VST plug-in is located. Note that, with some applications, it may also be required to *explicitly* scan for new VST pluig-ins. See the manual for details! The screen capture bellow shows the situation in the *Acoustica 6.0* software by Acon AS. Here we simply open the \"VST Directories\" dialogue from the \"Plug-Ins\" menu, then *add* the Dynamic Audio Normalizer directory and finally click \"OK\".\n\n![Setting up the new *VST Plug-In* directory (in Acoustica 6.0, Copyright © 2014 Acon AS)](img/dyauno/VSTPlugInDirs.png \"Dynamic Audio Normalizer – VST Plug-In\")\n\nFurthermore, note that – unless you are using the *static* build of the Dynamic Audio Normalizer – the VST plug-in DLL, i.e. ``DynamicAudioNormalizerVST.dll``, also requires the Dynamic Audio Normalizer *core* library, i.e. ``DynamicAudioNormalizerAPI.dll``. This means that the *core* library **must** be made available to the VST host *in addition* to the VST plug-in itself. Otherwise, loading the VST plug-in DLL is going to fail! Copying the *core* library to the same directory, where the VST plug-in DLL, is located generally is **not** sufficient. Instead, the *core* library must be located in one of those directories that are checked for additional DLL dependencies (see [**here**](http://msdn.microsoft.com/en-us/library/windows/desktop/ms682586%28v=vs.85%29.aspx#standard_search_order_for_desktop_applications) for details). Therefore, it is *recommended* to copy the ``DynamicAudioNormalizerAPI.dll`` file into the same directory where the VST host's \"main\" executable (EXE file) is located.\n\n**Important:** Please note that Dynamic Audio Normalizer VST plug-in uses the VST interface version 2.x, which is the most widely supported VST version at this time. VST interface version 3.x is *not* currently used, supported or required. Also note that *32-Bit* (x86) VST host application can <u>only</u> work with *32-Bit* VST plug-ins and, similarly, *64-Bit* (AMD64/Intel64) VST host application can <u>only</u> work with *64-Bit* VST plug-ins. Depending on the \"bitness\" of your individual VST host application, always the suitable VST plug-in DLL file, 32- or 64-Bit, must be chosen!\n\n\n## Known VST Limitations ##\n\nThe algorithm used by the Dynamic Audio Normalizer uses a \"look ahead\" buffer. This necessarily requires that – at the beginning of the process – we read a certain minimum number of *input* samples <u>before</u> the first *output* samples can be computed. With a more flexible effect interface, like the one used by [SoX](http://sox.sourceforge.net/), the plug-in could request as many input samples from the host application as required, before it starts returning output samples. The *VST* interface, however, is rather limited in this regard: VST *enforces* that the plug-in process the audio in small chunks. The size of these chunks is *dictated* by the host application. Furthermore, VST *enforces* that the plug-in returns the corresponding output samples for each chunk of audio data *immediately* – the VST host won't provide the next chunk of input samples until the VST plug-in has returned the output samples for the previous chunk. To the best of our knowledge, there is **no** way to request even more input samples from the VST host! Consequently, the **only** known way to realize a \"look ahead\" buffer with VST is actually <u>delaying</u> all audio samples and returning some \"silent\" samples at the beginning.\n\nAt least, VST provides the VST plug-in with a method to *report* its delay to the VST host application. Unfortunately, to the best of our knowledge, the VST specification lacks a detailed description on how a host application is required to deal with such a delay. This means that the actual behavior totally depends on the individual host application! Anyway, it is clear that, if a VST plug-in reports a delay of N samples, an audio editor **shall** discard the *first* N samples returned by that plug-in. Also, the audio editor **shall** feed N samples of additional \"dummy\" data to the plug-in at the very end of the process – in order to flush the pending output samples. In practice, however, it turns out that, while *some* audio editors show the \"correct\" behavior, others do **not**. Those audio editors seem to *ignore* the plug-in's delay, so the audio file will end up shifted and truncated!\n\nThe Dynamic Audio Normalizer VST plug-in *does* report its delay to the VST host application. Thus, if you encounter shifted and/or truncated audio after the processing, this means that there is a **bug** in the VST host application. And, sadly, the plug-in can do absolutely *nothing* about this. Below, there is a non-exhaustive list of audio editors with *proper* VST support. Those have been tested to work correctly. There also is a list of audio editors with *known problems*. Those should **not** be used for VST processing, until the respective developers have fixed the issue…\n\n### List of functioning VST Hosts ### {-}\n\nIncomplete list of VST hosts that have been tested to *work correctly* with the Dynamic Audio Normalizer VST plug-in:\n\n* **[Audacity](http://sourceforge.net/projects/audacity/files/audacity/) v2.1.2, by Audacity Team** &nbsp;|&nbsp; <span style=\"color:GoldenRod\">**recommended!**</span>\n    - Status: <span style=\"color:SeaGreen\">VST support working</span>\n    - License: free/libre OpenSource software\n    - *Note: See [**here**](http://wiki.audacityteam.org/wiki/VST_Plug-ins) for install instructions and make sure that the \"Buffer Delay Compensation\" option is enabled!*\n\n* **[Acoustica](http://acondigital.com/products/acoustica-audio-editor/) v6.0 (Build 19), by Acon AS** &nbsp;|&nbsp; <span style=\"color:GoldenRod\">**recommended!**</span>\n    - Status: <span style=\"color:SeaGreen\">VST support working</span>\n    - License: Proprietary, free \"basic\" edition available\n  \n* **[GoldWave](http://www.goldwave.com/) v5.70, by GoldWave Inc.**  \n    - Status: <span style=\"color:SeaGreen\">VST support working</span>\n    - License: Proprietary, fully functional \"evaluation\" version available\n    - *Note: <span style=\"color:FireBrick\">There currently is a VST regression in version 6.x that inserts silence at the beginning of the file!</span>*\n\n* **[Audition](https://creative.adobe.com/products/audition) (formerly \"Cool Edit Pro\") v10.0.1, by Adobe Systems Inc.**  \n    - Status: <span style=\"color:SeaGreen\">VST support working</span>\n    - License: Proprietary, free *trial* version available\n\n* **[WaveLab](http://www.steinberg.net/en/products/wavelab/start.html) v9.0, by Steinberg Media Technologies GmbH**\n    - Status: <span style=\"color:SeaGreen\">VST support working</span>\n    - License: Proprietary, free *trial* version available\n\n* **[REAPER](http://www.reaper.fm/) v5.33, by Cockos Inc.**  \n    - Status: <span style=\"color:SeaGreen\">VST support working</span>\n    - License: Proprietary, free *trial* version available\n\n* **[Sound Forge Pro](http://www.magix-audio.com/de/sound-forge/), by Magix (formerly Sony)**  \n    - Status: <span style=\"color:SeaGreen\">VST support working</span>\n    - License: Proprietary, free *trial* version available\n\n*<u>Disclaimer:</u> There is absolutely **no** guarantee for the completeness or correctness of the above information!*\n\n### List of problematic VST Hosts ### {-}\n\nList of VST hosts with *known problems* that do **not** work correctly with VST plug-ins like the Dynamic Audio Normalizer:\n  \n* **[Waveosaur](http://www.wavosaur.com/) v1.2.0**  \n    - Status: <span style=\"color:FireBrick\">VST support broken</span> → audio will be shifted and truncated\n    - License: Proprietary, freeware version available\n\n* **[Ocenaudio](http://www.ocenaudio.com.br/) v3.2.2**  \n    - Status: <span style=\"color:FireBrick\">VST support broken</span> → audio will be shifted and truncated + some plug-in settings are displayed incorrectly\n    - License: Proprietary, freeware version available\n  \n* **[WavePad](http://www.nch.com.au/wavepad/) v6.53, by NCH Software**  \n    - Status: <span style=\"color:FireBrick\">VST support broken</span> → audio will be shifted and truncated + doesn't expose the plug-in's settings\n    - License: Proprietary, freeware version available\n  \n* **[Nero WaveEditor](http://www.nero.com/enu/downloads/) v12.5, by Nero AG**  \n    - Status: <span style=\"color:FireBrick\">VST support broken</span> → application crashes when trying to load *any* VST plug-in for some unknown reason\n    - License: Proprietary, freeware version available\n  \n* **[Audiodope](http://www.audiodope.org/) v0.26**, by Audiodope team  \n    - Status: <span style=\"color:FireBrick\">VST support broken</span> → audio will be shifted and truncated + plug-in settings are displayed incorrectly\n    - License: Proprietary, freeware version available\n  \n* **[Dexster Audio Editor](http://www.dexster.net/) v4.5, by Softdiv**  \n    - Status: <span style=\"color:FireBrick\">VST support broken</span> → audio will be shifted and truncated + doesn't expose the plug-in's settings\n    - License: Proprietary, free *trial* version available\n  \n* **[AudioDirector](http://www.cyberlink.com/products/audiodirector/features_en_US.html) v7.0, by CyberLink Corp**  \n    - Status: <span style=\"color:FireBrick\">VST support broken</span> → audio will be shifted and truncated by a very large amount\n    - License: Proprietary, free *trial* version available\n\n*<u>Disclaimer:</u> There is absolutely **no** guarantee for the completeness or correctness of the above information!*\n\n*If you are the developer of one of the \"problematic\" tools and you are interested in fixing the problem in your product, or if you have already fixed the problem in the meantime, then please let us know, so that we can update the information…*\n\n\n\n# Winamp Plug-In Usage #\n\nThe Dynamic Audio Normalizer is also available in the form of a **DSP/Effect** plug-in for [Winamp](http://www.winamp.com/), the popular media player created by Nullsoft. This way, the Dynamic Audio Normalizer can be applied to your audio files during playback, in *real-time*.\n\n![The Winamp DSP/Effect plug-in (Winamp is Copyright © 1997-2013 Nullsoft, Inc)](img/dyauno/WAPlugIn.png)\n\n\n## Install Instructions ##\n\nIf you have **not** installed the ***latest*** version of Winamp yet, please update your Winamp installation first. Although the development of Winamp seems to be discontinued and its future remains uncertain at this point, you can still download the *last* Winamp release (as of January 2017), which is *Winamp 5.666 \"Redux\"*, from one of the following download mirrors:\n* <http://meggamusic.co.uk/winamp/Winamp_Download.htm>\n* <http://www.filehorse.com/download-winamp/>\n* <http://codecpack.co/download/Nullsoft_Winamp.html>\n* <http://www.free-codecs.com/winamp_download.htm>\n\nBe sure to grab the *patched* (aka \"Redux\") edition of Winamp 5.666, which has some security issues fixed and some defunct \"online\" features removed. Older versions are generally *not* recommended and may *not* work with the plug-in! Once the *latest* version of Winamp 5.x is installed, simply copy the provided Winamp plug-in file ``DynamicAudioNormalizerWA5.dll`` into the directory for Winamp *DSP/Effect* plug-ins. By default, that is the sub-directory ``Plugins`` *inside* your Winamp installation directory. So, if Winamp was installed at ``C:\\Program Files (x86)\\Winamp``, the *default* plug-in directory would be ``C:\\Program Files (x86)\\Winamp\\Plugins``. If you have installed Winamp to a *different* directory or if you have changed the plug-in directory to a *different* location (see the Winamp \"Perferences\" dialogue), then please adjust the path accordingly!\n\nNote that copying the plug-in DLL into the ``Plugins`` directory may require administrative privileges. That's because ``C:\\Program Files (x86)`` is a protected system directory. Also note that the plug-in DLL **must** be *renamed* to ``dsp_dynaudnorm.dll`` in order to make Winmap recognize the DLL. Any other file name of your choice will work just as well, as long as it starts with the ``dsp_`` prefix. Once the plug-in DLL file is located at the correct place, e.g. ``C:\\Program Files (x86)\\Winamp\\Plugins\\dsp_dynaudnorm.dll``, it should appear in the Winamp \"Preferences\" dialogue after the next restart. More specifically, you should find the \"Dynamic Audio Normalizer\" plug-in on the \"Plug-ins\" → \"DSP/Effect\" page. Simply select the desired plug-in from the list of available *DSP/Effect* plug-ins and it will be active from now on.\n\nFurthermore, note that – unless you are using the *static* build of the Dynamic Audio Normalizer – the Winamp plug-in DLL also requires the Dynamic Audio Normalizer *core* library, i.e. ``DynamicAudioNormalizerAPI.dll``. This means that the *core* library **must** be made available to Winamp *in addition* to the DSP/Effect plug-in itself. Otherwise, loading the DSP/Effect plug-in DLL is going to fail! Though, copying the *core* library to the same directory, where the plug-in DLL is located, i.e. the ``Plugins`` directory, generally is **not** sufficient. Instead, the *core* library must be located in one of those directories that are checked for additional DLL dependencies (see [**here**](http://msdn.microsoft.com/en-us/library/windows/desktop/ms682586%28v=vs.85%29.aspx#standard_search_order_for_desktop_applications) for details). Therefore, it is *recommended* to copy the ``DynamicAudioNormalizerAPI.dll`` file into the same directory where the Winamp \"main\" executable (EXE file) is located.\n\n\n## Registry Settings\n\nThe Dynamic Audio Normalizer plug-in for Winamp does *not* currently provide a configuration dialogue. However, the most important settings are stored in the Windows registry and can be edited using the Registry Editor (`regedit.exe`):\n\n* The settings are stored under the following key:\n```\nHKEY_CURRENT_USER\\Software\\MuldeR\\DynAudNorm\\WA5\n```\n\n* The following reg-values are currently supported:\n\n    - **`FilterSize`**: Controlls the [*Gaussian filter window size*](#gaussian-filter-window-size), in frames (DWORD)\n\n    - **`FrameLenMsec`**: Controlls the [*frame length*](#frame-length), in milliseconds (DWORD)\n\n**Note:** If any of the registry values do not exist yet, simply create them. Restart Winamp to make your changes take effect!\n\n\n## Known Limitations ##\n\nUnfortunately, the programming interface (API) that Winamp offers to *DSP/Effect* plug-in is ***very*** limited. In particular, Winamp does **not** report to the plug-in when playback starts or stops, it does **not** report to the plug-in when switching to another track, and it does **not** report to the plug-in when seeking within the current track. Also, in **none** of the aforementioned situations Winamp is going to re-initialize the plug-in. Instead, Winamp just feeds the plug-in with an \"unbroken\" stream of audio samples &ndash; even when the user seeks to a different position in the current track or switches to a completely different track.\n\nConsequently, it is **not** technically possible for the plug-in to \"flush\" its internal buffer in the relevant situations! As a result, users will experience a delay of approximately 15 seconds when the Dynamic Audio Normalizer plug-in for Winamp is active. If, for example, you move the slider on Winamp's seek bar, it will take about 15 seconds until you actually hear the audio from the new position. Similarly, if you switch to another track, it will take about 15 seconds until you actually hear the audio from the new track. *To make it clear again:* Only the Winamp developers could fix this annoyance &ndash; by providing DSP/Effect plug-in developers with a more suitable API. However, given the current state of Winamp development, this is unlikely to happen.\n\n\n\n\n\n# Configuration #\n\nThis chapter describes the configuration options that can be used to tweak the behavior of the Dynamic Audio Normalizer.\n\nWhile the default parameter of the Dynamic Audio Normalizer have been chosen to give satisfying results for a wide range of audio sources, it can be advantageous to adapt the parameters to the individual audio file as well as to your personal preferences. The *default* settings have been chosen rather \"conservative\", so that the dynamics of the audio are preserved well. People who desire a more \"aggressive\" effect should try using a *smaller* [*filter size*](#gaussian-filter-window-size), or enable [*input compression*](#input-compression).\n\n\n## Gaussian Filter Window Size ##\n\nProbably the most important parameter of the Dynamic Audio Normalizer is the \"window size\" of the Gaussian smoothing filter. It can be controlled with the **``--gauss-size``** option. The filter's window size is specified in *frames*, centered around the current frame. For the sake of simplicity, this must be an *odd* number. Consequently, the default value of **31** takes into account the current frame, as well as the *15* preceding frames and the *15* subsequent frames. Using a *larger* Gaussian window size results in a *stronger* smoothing effect and thus in *less* gain variation, i.e. slower gain adaptation. Conversely, using a *smaller* Gaussian window size results in a *weaker* smoothing effect and thus in *more* gain variation, i.e. faster gain adaptation. In other words, the more you *increase* this value, the more the Dynamic Audio Normalizer will behave like a \"traditional\" (non-dynamic) normalization filter. On the contrary, the more you *decrease* this value, the more \"aggressively\" the Dynamic Audio Normalizer will behave, i.e. more like a dynamic range *compressor*. The following graph illustrates the effect of different Gaussian window sizes – *11* (orange), *31* (green), and *61* (purple) frames – on the progression of the final filtered gain factor.\n\n![The effect of different \"window sizes\" of the Gaussian smoothing filter](img/dyauno/FilterSize.png)\n\n\n## Target Peak Magnitude ##\n\nThe target peak magnitude specifies the highest permissible magnitude level for the *normalized* audio file. It is controlled by the **``--peak``** option. Since the Dynamic Audio Normalizer represents audio samples as floating point values in the *-1.0* to *1.0* range – regardless of the input and output audio format – this value must be in the *0.0* to *1.0* range. Consequently, the value *1.0* is equal to [0 dBFS](http://en.wikipedia.org/wiki/DBFS), i.e. the maximum possible digital signal level (± 32767 in a 16-Bit file). The Dynamic Audio Normalizer will try to approach the target peak magnitude as closely as possible, but at the same time it also makes sure that the normalized signal will *never* exceed the peak magnitude. A frame's maximum local gain factor is imposed directly by the target peak magnitude. The default value is **0.95** and thus leaves a [headroom](http://en.wikipedia.org/wiki/Headroom_%28audio_signal_processing%29) of *5%*. It is **not** recommended to go *above* this value!\n\n\n## Channel Coupling ##\n\nBy default, the Dynamic Audio Normalizer will amplify all channels by the same amount. This means the *same* gain factor will be applied to *all* channels, i.e. the maximum possible gain factor is determined by the \"loudest\" channel. In particular, the highest magnitude sample for the `n`-th frame is defined as `S_max[n]=Max(s_max[n][1],s_max[n][2],…,s_max[n][C])`, where `s_max[n][k]` denotes the highest magnitude sample in the `k`-th channel and `C` is the channel count. The gain factor for *all* channels is then derived from `S_max[n]`. This is referred to as *channel coupling* and for most audio files it gives the desired result. Therefore, channel coupling is *enabled* by default. However, in some recordings, it may happen that the volume of the different channels is *uneven*, e.g. one channel may be \"quieter\" than the other one(s). In this case, the **`--no-coupling`** option can be used to *disable* the channel coupling. This way, the gain factor will be determined *independently* for each channel `k`, depending only on the individual channel's highest magnitude sample `s_max[n][k]`. This allows for harmonizing the volume of the different channels. The following wave view illustrates the effect of channel coupling: It shows an input file with *uneven* channel volumes (left), the same file after normalization with channel coupling *enabled* (center) and again after normalization with channel coupling *disabled* (right).\n\n![The effect of *channel coupling*](img/dyauno/Coupling.png)\n\n\n## DC Bias Correction##\n\nAn audio signal (in the time domain) is a sequence of sample values. In the Dynamic Audio Normalizer these sample values are represented in the *-1.0* to *1.0* range, regardless of the original input format. Normally, the audio signal, or \"waveform\", should be centered around the *zero point*. That means if we calculate the *mean* value of all samples in a file, or in a single frame, then the result should be *0.0* or at least very close to that value. If, however, there is a significant deviation of the mean value from *0.0*, in either positive or negative direction, this is referred to as a [*DC bias*](http://en.wikipedia.org/wiki/DC_bias) or *DC offset*. Since a DC bias is clearly undesirable, the Dynamic Audio Normalizer provides optional *DC bias correction*, which can be enabled using the **``--correct-dc``** switch. With DC bias correction *enabled*, the Dynamic Audio Normalizer will determine the mean value, or \"DC correction\" offset, of each input frame and *subtract* that value from all of the frame's sample values – which ensures those samples are centered around *0.0* again. Also, in order to avoid \"gaps\" at the frame boundaries, the DC correction offset values will be interpolated smoothly between neighbouring frames. The following wave view illustrates the effect of DC bias correction: It shows an input file with positive DC bias (left), the same file after normalization with DC bias correction *disabled* (center) and again after normalization with DC bias correction *enabled* (right).\n\n![The effect of *DC Bias Correction*](img/dyauno/DCCorrection.png)\n\n\n## Maximum Gain Factor ##\n\nThe Dynamic Audio Normalizer determines the maximum possible (local) gain factor for each input frame, i.e. the maximum gain factor that does *not* result in clipping or distortion. The maximum gain factor is determined by the frame's highest magnitude sample. However, the Dynamic Audio Normalizer *additionally* bounds the frame's maximum gain factor by a predetermined (global) *maximum gain factor*. This is done in order to avoid \"extreme\" gain factors in silent, or almost silent, frames. By default, the *maximum gain factor* is **10.0**, but it can be adjusted using the **``--max-gain``** switch. For most input files the default value should be sufficient, and it usually is **not** recommended to increase this value above the default. Though, for input files with a rather low overall volume level, it may be necessary to allow even higher gain factors. Be aware, however, that the Dynamic Audio Normalizer does *not* simply apply a \"hard\" threshold (i.e. it does *not* simply cut off values above the threshold). Instead, a \"sigmoid\" thresholding function will be applied on the final gain factors, as depicted in the following chart. This way, the gain factors will smoothly approach the threshold value, but they will *never* exceed that value.\n\n![The Gain Factor Threshold-Function](img/dyauno/Threshold.png)\n\n\n## Target RMS Value ##\n\nBy default, the Dynamic Audio Normalizer performs \"peak\" normalization. This means that the maximum local gain factor for each frame is defined (only) by the frame's highest magnitude sample (the \"loudest\" peak). This way, the samples can be amplified as much as possible *without* exceeding the maximum signal level, i.e. *without* clipping. Optionally, however, the Dynamic Audio Normalizer can also take into account the frame's [*root mean square*](http://en.wikipedia.org/wiki/Root_mean_square), or, in short, **RMS**. In electrical engineering, the RMS is commonly used to determine the *power* of a time-varying signal. It is therefore considered that the RMS is a better approximation of the \"perceived loudness\" than just looking at the signal's peak magnitude. Consequently, by adjusting all frames to a *constant* RMS value, a *uniform* \"perceived loudness\" can be established. With the Dynamic Audio Normalizer, RMS processing can be enabled using the **``--target-rms``** switch. This specifies the desired RMS value, in the *0.0* to *1.0* range. There is **no** default value, because RMS processing is *disabled* by default. If a target RMS value has been specified, a frame's local gain factor is defined as the factor that would result in exactly *that* RMS value. Note, however, that the maximum local gain factor is still restricted by the frame's highest magnitude sample, in order to prevent clipping. The following chart shows the same file normalized *without* (green) and *with* (orange) RMS processing enabled.\n\n![Root Mean Square (RMS) processing example](img/dyauno/RMS.png)\n\n\n## Frame Length ##\n\nThe Dynamic Audio Normalizer processes the input audio in small chunks, referred to as *frames*. This is required, because a *peak magnitude* has no meaning for just a single sample value. Instead, we need to determine the peak magnitude for a contiguous sequence of sample values. While a \"standard\" normalizer would simply use the peak magnitude of the *complete* file, the Dynamic Audio Normalizer determines the peak magnitude *individually* for each frame. The length of a frame is specified in milliseconds. By default, the Dynamic Audio Normalizer uses a frame length of **500** milliseconds, which has been found to give good results with most files, but it can be adjusted using the **``--frame-len``** switch. Note that the exact frame length, in number of samples, will be determined automatically, based on the sampling rate of the individual input audio file.\n\n\n## Boundary Mode ##\n\nAs explained before, the Dynamic Audio Normalizer takes into account a certain neighbourhood around each frame. This includes the *preceding* frames as well as the *subsequent* frames. However, for the \"boundary\" frames, located at the very beginning and at the very end of the audio file, **not** all neighbouring frames are available. In particular, for the *first* few frames in the audio file, the preceding frames are *not* known. And, similarly, for the *last* few frames in the audio file, the subsequent frames are *not* known. Thus, the question arises which gain factors should be assumed for the *missing* frames in the \"boundary\" region. The Dynamic Audio Normalizer implements two modes to deal with this situation. The *default* boundary mode assumes a gain factor of exactly *1.0* for the missing frames, resulting in a smooth \"fade in\" and \"fade out\" at the beginning and at the end of the file, respectively. The *alternative* boundary mode can be enabled by using the **``--alt-boundary``** switch. The latter mode assumes that the missing frames at the *beginning* of the file have the same gain factor as the very *first* available frame. It furthermore assumes that the missing frames at the *end* of the file have same gain factor as the very *last* frame. The following chart illustrates the difference between the *default* (green) and the *alternative* (red) boundary mode. Note hat, for simplicity's sake, a file containing *constant* volume white noise was used as input here.\n\n![Default boundary mode vs. alternative boundary mode](img/dyauno/Boundary.png)\n\n\n## Input Compression ##\n\nBy default, the Dynamic Audio Normalizer does **not** apply \"traditional\" compression. This means that signal peaks will **not** be pruned and thus the *full* dynamic range will be retained within each local neighbourhood. However, in some cases it may be desirable to *combine* the Dynamic Audio Normalizer's normalization algorithm with a more \"traditional\" compression. For this purpose, the Dynamic Audio Normalizer provides an *optional* compression (thresholding) function. It is disabled by default and can be enabled by using the **``--compress``** switch. If (and only if) the compression feature is enabled, all input frames will be processed by a [*soft knee*](https://mdn.mozillademos.org/files/5113/WebAudioKnee.png) thresholding function *prior to* the actual normalization process. Put simply, the thresholding function is going to prune all samples whose magnitude exceeds a certain threshold value. However, the Dynamic Audio Normalizer does *not* simply apply a fixed threshold value. Instead, the threshold value will be adjusted for each individual frame. More specifically, the threshold for a specific input frame is defined as ``T = μ + (c · σ)``, where **μ** is the *mean* of all sample magnitudes in the current frame, **σ** is the *standard deviation* of those sample magnitudes and **c** is the parameter controlled by the user. Note that, assuming the samples magnitudes are following (roughly) a [normal distribution](http://content.answcdn.com/main/content/img/barrons/accounting/New/images/normaldistribution2.jpg), about 68% of the sample values will be within the **μ ± σ** range, about 95% of the sample values will be within the **μ ± 2σ** range and more than 99% of the sample values will be within the **μ ± 3σ** range. Consequently, a parameter of **c = 2** will prune about 5% of the frame's highest magnitude samples, a parameter of **c = 3** will prune about 1% of the frame's highest magnitude samples, and so on. In general, *smaller* parameters result in *stronger* compression, and vice versa. Values below *3.0* are **not** recommended, because audible distortion may appear! The following waveform view illustrates the effect of the input compression feature: It shows the same input file *before* (upper view) and *after* (lower view) the thresholding function has been applied. Please note that, for the sake of clarity, the actual normalization process has been *disabled* in the following chart. Under normal circumstances, the normalization process is applied immediately after the thresholding function.\n\n![The effect of the input compression (thresholding) function](img/dyauno/Compression-1.png)\n\n\n## Write Log File ##\n\nOptionally, the Dynamic Audio Normalizer can create a log file. The log file name is specified using the **``--log-file``** option.  If that option is *not* used, then *no* log file will be written. The log file uses a simple text format. The file starts with a header, followed by a list of gain factors. In that list, there is one line per frame. In each line, the *first* column contains the maximum local gain factor, the *second* column contains the minimum filtered gain factor, and the *third* column contains the final smoothed gain factor. This sequence is repeated once per channel.\n\n\tDynamicAudioNormalizer Logfile v2.00-5\n\tCHANNEL_COUNT:2\n\t\n\t10.00000  8.59652  5.07585      10.00000  8.59652  5.07585\n\t 8.59652  8.59652  5.64167       8.59652  8.59652  5.64167\n\t 9.51783  8.59652  6.17045       9.51783  8.59652  6.17045\n\t...\n\nThe log file can be displayed as a graphical chart using, for example, the *Log Viewer* application (DynamicAudioNormalizerGUI) that is included with the Dynamic Audio Normalizer:\n\n![Dynamic Audio Normalizer - Log Viewer](img/dyauno/LogViewer.png)\n\n\n\n# API Documentation #\n\nThis chapter describes the **MDynamicAudioNormalizer** application programming interface (API). The API specified in this document allows software developer to call the *Dynamic Audio Normalizer* library from their own programs.\n\n\n## Language Bindings ##\n\nThe Dynamic Audio Normalizer \"core\" library is written in [***C++***](http://en.wikipedia.org/wiki/C%2B%2B). Therefore the *native* application programming interface (API) is provided in the form of a *C++* class. Furthermore, language bindings for the [***Microsoft.NET***]() platform (*C#*, *VB.NET*, etc.) as well as for [***Java***](http://en.wikipedia.org/wiki/Java_%28programming_language%29) (JRE 1.7 or later), [***Python***](https://www.python.org/) (CPython 3.0 or later) and [***Object Pascal***](http://en.wikipedia.org/wiki/Object_Pascal) (*Delphi 7.0* or later) are provided. For each of these languages, a suitable \"wrapper\" is provided, which exposes – to the greatest extend possible – the same functions as the native *C++* class. Calls to the language-specific wrapper will be forwarded, *internally*, to the corresponding native method of to the underlying *C++* class. Native library calls are handled *transparently* by the individual language wrapper, so that application developers do **not** need to worry about interoperability issues. In particular, the language wrapper will take care of data marshalling as well as the management of the native *MDynamicAudioNormalizer* instances.\n\n### C++ interface\n\n*C++* applications shall use the native **MDynamicAudioNormalizer** C++ class *directly*, which is declared in the `DynamicAudioNormalizerAPI.h` header file. It is implemented by the shared library `DynamicAudioNormalizerAPI.dll` (Windows) or `libDynamicAudioNormalizerAPI-X.so` (Linux). A detailed description of the *C++* class is given [*below*](#function-reference).\n\n***Note***: On the Windows platform, you will need to link your binary against the *import* library `DynamicAudioNormalizerAPI.lib`.\n\n### C99 interface\n\n*C* applications can use the *C99* \"wrapper\" functions, which are also declared in the `DynamicAudioNormalizerAPI.h` header file. Those \"wrapper\" functions are implemented by the shared library `DynamicAudioNormalizerAPI.dll` (Windows) or `libDynamicAudioNormalizerAPI-X.so` (Linux), just like the native *C++* interface. There exists a corresponding *C99* \"wrapper\" function for each method of the native *C++* class. The \"wrapper\" functions provide the same functionality and take the same parameters as the underlying *C++* methods, except that an additional [*handle*](http://en.wikipedia.org/wiki/Handle_%28computing%29) parameter needs to be passed to each \"wrapper\" function. The handle corresponds to the \"this\" pointer that is *implicitly* passed to C++ methods. The *C*-only functions `createInstance()` and `destroyInstance()` correspond to the *C++* class' constructor and destructor, respectively.\n\n***Note***: On the Windows platform, you will need to link your binary against the *import* library `DynamicAudioNormalizerAPI.lib`.\n\n### Microsoft.NET interface\n\n*Microsoft.NET* (*C#*, *VB.NET*, etc.) applications can use the **DynamicAudioNormalizerNET** [*C++/CLI*](http://en.wikipedia.org/wiki/C%2B%2B/CLI) \"wrapper\" class, which is implemented by the `DynamicAudioNormalizerNET.dll` assembly. There exists an equivalent method in the *C++/CLI* \"wrapper\" class for each method of the native *C++* class. Note, however, that the `DynamicAudioNormalizerNET.dll` assembly is really just a thin \"wrapper\" and it requires the *native* \"core\" library `DynamicAudioNormalizerAPI.dll` at runtime!\n\n### Java interface\n\n*Java* applications can use the **JDynamicAudioNormalizer** [*JNI*](https://en.wikipedia.org/wiki/Java_Native_Interface) \"wrapper\" class, which is implemented by the `DynamicAudioNormalizerJNI.jar` library. There exists an equivalent method in the *JNI* \"wrapper\" class for each method of the native *C++* class. Note, however, that the `DynamicAudioNormalizerJNI.jar` *JNI* \"wrapper\" requires the *native* \"core\" library `DynamicAudioNormalizerAPI.dll` (Windows) or `libDynamicAudioNormalizerAPI-X.so` (Linux) at runtime!\n\n### Python interface\n\n*Python* applications can use our [*C extension for CPython*](https://docs.python.org/3/extending/building.html), which is implemented by the `DynamicAudioNormalizerAPI.pyd` library. We also provide the **PyDynamicAudioNormalizer** *Python* \"wrapper\" class for convenience, which is declared in the `DynamicAudioNormalizer.py` module. There exists an equivalent method in the *Python* \"wrapper\" class for each method of the native *C++* class. Note, however, that the `DynamicAudioNormalizerJNI.pyd` *C extension* module requires the *native* \"core\" library `DynamicAudioNormalizerAPI.dll` (Windows) or `libDynamicAudioNormalizerAPI-X.so` (Linux) at runtime!\n\n### Object Pascal interface\n\n*Object Pascal* (Delphi) applications can use the **TDynamicAudioNormalizer** [*Object Pascal*](https://en.wikipedia.org/wiki/Object_Pascal) \"wrapper\" class, which is implemented by the `DynamicAudioNormalizer.pas` unit file. There exists an equivalent method in the *Object Pascal* \"wrapper\" class for each method of the native *C++* class. Note, however, that the `DynamicAudioNormalizer.pas` *Object Pascal* \"wrapper\" is built on top of the *C99* API and it requires the *native* library `DynamicAudioNormalizerAPI.dll` at runtime!\n\n## Thread Safety ##\n\nAll methods of the `MDynamicAudioNormalizer` class are [*reentrant*](https://doc.qt.io/qt-4.8/threads-reentrancy.html#reentrancy), but **not** [*thread-safe*](https://doc.qt.io/qt-4.8/threads-reentrancy.html#thread-safety)! Hence, it ***is*** safe to use the MDynamicAudioNormalizer class in *multi-threaded* applications, but **only** as long as each thread uses its \"own\" separate MDynamicAudioNormalizer instance. In other words, it is *strictly forbidden* to call the *same* MDynamicAudioNormalizer instance *concurrently* from *different* threads. But it ***is*** admissible to call *distinct* MDynamicAudioNormalizer instances *concurrently* from *different* threads &ndash; provided that each thread will access *only* its \"own\" instance. If the *same* MDynamicAudioNormalizer instance needs to be accessed by *different* threads, then the calling application is responsible for *serializing* each and every call to that instance, e.g. by means of a Mutex; otherwise **undefined behavior** follows!\n\nThere is *one* notable exception from the above restrictions: The **static** methods of the `MDynamicAudioNormalizer` class as well as the `createInstance()` function of the \"C99\" API ***are*** perfectly *thread-safe*. No synchronization is needed for those.\n\n\n## Quick Start Guide ##\n\nThe following listing summarizes the steps that an application needs to follow when using the API:\n\n1. Create a new *MDynamicAudioNormalizer* instance. This allocates required resources.\n2. Call the ``initialize()`` method, *once*, in order to initialize the MDynamicAudioNormalizer instance.\n3. Call the ``processInplace()`` method, *in a loop*, until all input samples have been processed.  \n    - **Note:** At the beginning, this function returns *less* output samples than input samples have been passed. Samples are guaranteed to be returned in FIFO order, but there is a certain \"delay\"; call `getInternalDelay()` for details.\n4. Call the ``flushBuffer()`` method, *in a loop*, until all the pending \"delayed\" output samples have been flushed.\n5. Destroy the *MDynamicAudioNormalizer* instance. This will free up all allocated resources.\n\n*Note:* The Dynamic Audio Normalizer library processes audio samples, but it does **not** provide any audio I/O capabilities. Reading or writing the audio samples from or to an audio file is up to the application. A library like [libsndfile](http://www.mega-nerd.com/libsndfile/) is helpful!\n\n\n## Function Reference ##\n\n### MDynamicAudioNormalizer::MDynamicAudioNormalizer() ### {-}\n```\nMDynamicAudioNormalizer(\n\tconst uint32_t channels,\n\tconst uint32_t sampleRate,\n\tconst uint32_t frameLenMsec,\n\tconst uint32_t filterSize,\n\tconst double peakValue,\n\tconst double maxAmplification,\n\tconst double targetRms,\n\tconst bool channelsCoupled,\n\tconst bool enableDCCorrection,\n\tconst bool altBoundaryMode,\n\tFILE *const logFile\n);\n```\n\nConstructor. Creates a new *MDynamicAudioNormalizer* instance and sets up the normalization parameters.\n\n**Parameters:**\n* *channels*: The number of channels in the input/output audio stream (e.g. **2** for Stereo).\n* *sampleRate*: The sampling rate of the input/output audio stream, in Hertz (e.g. **44100** for \"CD Quality\").\n* *frameLenMsec*: The [frame length](#frame-length), in milliseconds. A typical value is **500** milliseconds.\n* *filterSize*: The [\"window size\"](#gaussian-filter-window-size) of the Gaussian filter, in frames. Must be an *odd* number. (default: **31**).\n* *peakValue*: Specifies the [peak magnitude](#target-peak-magnitude) for normalized audio, in the **0.0** to **1.0** range (default: **0.95**).\n* *maxAmplification*: Specifies the [maximum gain factor](#maximum-gain-factor). Must be greater than **1.0** (default: **10.0**).\n* *targetRms*: Specifies the [target RMS](#target-rms-value) value. Must be in the **0.0** to **1.0** range, **0.0** means *disabled* (default: **0.0**).\n* *channelsCoupled*: Set to **true** in order to enable [channel coupling](#channel-coupling), or to **false** otherwise (default: **true**).\n* *enableDCCorrection*: Set to **true** in order to enable [DC correction](#dc-bias-correction), or to **false** otherwise (default: **false**).\n* *altBoundaryMode*: Set to **true** in order to enable the alternative [boundary mode](#boundary-mode) (default: **false**).\n* *logFile*: An open **FILE*** handle with *write* access to be used for [logging](#write-log-file), or **NULL** to disable logging.\n\n\n### MDynamicAudioNormalizer::~MDynamicAudioNormalizer() ### {-}\n```\nvirtual ~MDynamicAudioNormalizer(void);\n```\n\nDestructor. Destroys the *MDynamicAudioNormalizer* instance and releases all memory that it occupied.\n\n\n### MDynamicAudioNormalizer::initialize() ### {-}\n```\nbool initialize(void);\n```\n\nInitializes the MDynamicAudioNormalizer instance. Validates the parameters and allocates the required memory buffers.\n\nThis function *must* be called once for each new MDynamicAudioNormalizer instance. It *must* be called *before the `processInplace()` function can be called for the first time. Do **not** call `processInplace()`, if this function has failed!\n\n**Return value:**\n* Returns `true` if everything was successful or `false` if something went wrong.\n\n\n### MDynamicAudioNormalizer::process() ### {-}\n```\nbool process(\n\tconst double **samplesIn,\n\tdouble **samplesOut,\n\tint64_t inputSize,\n\tint64_t &outputSize\n);\n```\n\nThis is the \"main\" processing function. It shall be called *in a loop* until all input audio samples have been processed.\n\nThe function works \"out-of-place\": It *reads* the original input samples from the specified `samplesIn` buffer and then *writes* the normalized output samples, if any, back into the `samplesOut` buffer. The content of `samplesIn` will be preserved.\n\n***Note:*** A call to this function reads *all* provided input samples from the buffer, but the number of output samples that are written back to the buffer may actually be *smaller* than the number of input samples that have been read! The pending samples are buffered internally and will be returned in a subsequent call. In other words, samples are returned with a certain \"delay\". This means that the *i*-th output sample does **not** necessarily correspond to the *i*-th input sample! Still, the samples are returned in strict [FIFO](https://en.wikipedia.org/wiki/FIFO_(computing_and_electronics)) order. The exact delay can be determined by calling the `getInternalDelay()` function. At the end of the process, when all input samples have been read, to application shall call `flushBuffer()` in order to *flush* all pending samples.\n\n**Parameters:**\n* *samplesIn*: The input buffer. This buffer contains the original input samples to be read. It will be treated as a *read-only* buffer. The *i*-th input sample for the *c*-th channel is assumed to be stored at `samplesIn[c][i]`, as a double-precision floating point number. All indices are *zero*-based. All sample values live in the **-1.0** to **+1.0** range.\n* *samplesOut*: The output buffer. The processed output samples will be written back to this buffer. Its initial contents will therefore be *overwritten*. The *i*-th output sample for the *c*-th channel will be stored at `samplesOut[c][i]`. The size of the buffer must be sufficient! All indices are *zero*-based. All sample values live in the **-1.0** to **+1.0** range.\n* *inputSize*: The number of original *input* samples that are available in the `samplesIn` buffer, per channel. This also specifies the *maximum* number of output samples that can be written back to the `samplesOut` buffer.\n* *outputSize*: Receives the number of *output* samples that have actually been written back to the `samplesOut` buffer, per channel. Please note that this value can be *smaller* than the `inputSize` value. It can even be *zero*!\n\n**Return value:**\n* Returns `true` if everything was successful or `false` if something went wrong.\n\n\n### MDynamicAudioNormalizer::processInplace() ### {-}\n```\nbool processInplace(\n\tdouble **samplesInOut,\n\tint64_t inputSize,\n\tint64_t &outputSize\n);\n```\n\nThis is the \"main\" processing function. It shall be called *in a loop* until all input audio samples have been processed.\n\nThe function works \"in-place\": It *reads* the original input samples from the specified buffer and then *writes* the normalized output samples, if any, back into the *same* buffer. So, the content of `samplesInOut` will **not** be preserved!\n\n***Note:*** A call to this function reads *all* provided input samples from the buffer, but the number of output samples that are written back to the buffer may actually be *smaller* than the number of input samples that have been read! The pending samples are buffered internally and will be returned in a subsequent call. In other words, samples are returned with a certain \"delay\". This means that the *i*-th output sample does **not** necessarily correspond to the *i*-th input sample! Still, the samples are returned in strict [FIFO](https://en.wikipedia.org/wiki/FIFO_(computing_and_electronics)) order. The exact delay can be determined by calling the `getInternalDelay()` function. At the end of the process, when all input samples have been read, to application shall call `flushBuffer()` in order to *flush* all pending samples.\n\n**Parameters:**\n* *samplesInOut*: The input/output buffer. This buffer initially contains the original input samples to be read. Also, the processed output samples will be written back to this buffer. The *i*-th input sample for the *c*-th channel is assumed to be stored at `samplesInOut[c][i]`, as a double-precision floating point number. The output samples, if any, will be stored at the corresponding locations, thus *overwriting* the input data. Consequently, the *i*-th output sample for the *c*-th channel will be stored at `samplesInOut[c][i]`. All indices are *zero*-based. All sample values live in the **-1.0** to **+1.0** range.\n* *inputSize*: The number of original *input* samples that are available in the `samplesInOut` buffer, per channel. This also specifies the *maximum* number of output samples that can be written back to the buffer.\n* *outputSize*: Receives the number of *output* samples that have actually been written back to the `samplesInOut` buffer, per channel. Please note that this value can be *smaller* than the `inputSize` value. It can even be *zero*!\n\n**Return value:**\n* Returns `true` if everything was successful or `false` if something went wrong.\n\n\n### MDynamicAudioNormalizer::flushBuffer() ### {-}\n```\nbool flushBuffer(\n\tdouble **samplesOut,\n\tconst int64_t bufferSize,\n\tint64_t &outputSize\n);\n```\n\nThis function shall be called at the end of the process, after all input samples have been processed via `processInplace()` function, in order to flush the *pending* samples from the internal buffer. It writes the next pending output samples into the output buffer, in FIFO order, if and only if there are still any pending output samples left in the internal buffer. Once this function has been called, you must call `reset()` before the `processInplace()` function may be called again! If this function returns fewer output samples than the specified output buffer size, then this indicates that the internal buffer is empty now.\n\n**Parameters:**\n* *samplesOut*: The output buffer that will receive the normalized output samples. The *i*-th output sample for the *c*-th channel will be stored at `samplesOut[c][i]`. All indices are *zero*-based. All sample values live in the **-1.0** to **+1.0** range.\n* *bufferSize*: Specifies the *maximum* number of output samples to be stored in the output buffer.\n* *outputSize*: Receives the number of *output* samples that have actually been written to the `samplesOut` buffer. Please note that this value can be *smaller* than `bufferSize` size, if no more pending samples are left. It can even be *zero*!\n\n**Return value:**\n* Returns ``true`` if everything was successfull or ``false`` if something went wrong.\n\n\n### MDynamicAudioNormalizer::reset() ### {-}\n```\nbool reset(void);\n```\n\nResets the internal state of the *MDynamicAudioNormalizer* instance. It normally is **not** required or recommended to call this function! The only exception here is: If you really want to process *multiple* independent audio files with the *same* normalizer instance, then you *must* call the `reset()` function *after* all samples of the **current** audio file have been processed (and all of its pending samples have been flushed), but *before* processing the first sample of the **next** audio file.\n\n**Return value:**\n* Returns ``true`` if everything was successfull or ``false`` if something went wrong.\n\n\n### MDynamicAudioNormalizer::getConfiguration() ### {-}\n```\nbool getConfiguration(\n\tuint32_t &channels,\n\tuint32_t &sampleRate,\n\tuint32_t &frameLen,\n\tuint32_t &filterSize\n);\n```\n\nThis is a convenience function to retrieve the current configuration of an existing *MDynamicAudioNormalizer* instance.\n\n**Parameters:**\n* *channels*: Receives the number of channels that was set in the constructor.\n* *sampleRate*: Receives the sampling rate, in Hertz, that was set in the constructor.\n* *frameLen*: Receives the current frame length, in samples (**not** milliseconds).\n* *filterSize*: Receives the Gaussian filter size, in frames, that was set in the constructor.\n\n**Return value:**\n* Returns ``true`` if everything was successfull or ``false`` if something went wrong.\n\n\n### MDynamicAudioNormalizer::getInternalDelay() ### {-}\n```\nbool getInternalDelay(\n\tint64_t &delayInSamples,\n);\n```\n\nThis function can be used to determine the internal \"delay\" of the *MDynamicAudioNormalizer* instance. This is the (maximum) number of samples, per channel, that will be buffered internally. The `processInplace()` function will **not** return any output samples, until (at least) *this* number of input samples have been read. This also specifies the (maximum) number of samples, per channel, that need to be flushed from the internal buffer, at the end of the process, using the `flushBuffer()` function.\n\n**Parameters:**\n* *delayInSamples*: Receives the size of the internal buffer, in samples (per channel).\n\n**Return value:**\n* Returns ``true`` if everything was successful or ``false`` if something went wrong.\n\n\n### MDynamicAudioNormalizer::getVersionInfo() [static] ### {-}\n```\nstatic void getVersionInfo(\n\tuint32_t &major,\n\tuint32_t &minor,\n\tuint32_t &patch\n);\n```\n\nThis *static* function can be called to determine the Dynamic Audio Normalizer library version.\n\n**Parameters:**\n* *major*: Receives the major version number. Currently this value is **2**.\n* *minor*: Receives the minor version number. Value will be in the **0** to **99** range.\n* *patch*: Receives the patch level. Value will be in the **0** to **9** range.\n\n\n### MDynamicAudioNormalizer::getBuildInfo() [static] ### {-}\n```\nstatic void getBuildInfo(\n\tconst char **date,\n\tconst char **time,\n\tconst char **compiler,\n\tconst char **arch,\n\tbool &debug\n);\n```\n\nThis *static* function can be called to determine more detailed information about the specific Dynamic Audio Normalizer build.\n\n**Parameters:**\n* *date*: Receives a pointer to a *read-only* string buffer containing the build date, standard `__DATE__` format.\n* *time*: Receives a pointer to a *read-only* string buffer containing the build time, standard `__TIME__` format.\n* *compiler*: Receives a pointer to a *read-only* string buffer containing the compiler identifier (e.g. `MSVC 2013.2`).\n* *arch*: Receives a pointer to a *read-only* string buffer containing the architecture identifier (e.g. `x86` or `x64`).\n* *debug*: Will be set to `true` if this is a ***debug*** build; otherwise it will be set to `false`.\n\n\n### MDynamicAudioNormalizer::setLogFunction() [static] ### {-}\n```\nstatic LogFunction *setLogFunction(\n\tLogFunction *const logFunction\n);\n```\n\nThis *static* function can be called to register a *callback* function that will be called by the Dynamic Audio Normalizer in order to provide additional log messages. Note that initially **no** callback function will be registered. This means that until a callback function is registered by the application, all log messages will be *discarded*. It is recommend to register your callback function *before* creating the first *MDynamicAudioNormalizer* instance. Also note that <i>at most</i> one callback function can be registered. Registering another callback function <i>replaces</i> the previous one. However, since a pointer to the previous callback function will be returned, multiple callback function can be chained – simply call the previous callback from the new one.\n\n**Parameters:**\n* *logFunction*: A pointer to the new callback function to be registered. This can be ``NULL`` to disable logging entirely.\n\n**Return value:**\n* Returns a pointer to the *previous* callback function. This can be `NULL`, if **no** callback function was registered before.\n\n#### Callback Function #### {-}\n\nThe signature of the callback function must be *exactly* as follows, with standard `cdecl` calling convention:\n```\nvoid LogFunction(\n\tconst int logLevel,\n\tconst char *const message\n);\n```\n\n**Parameters:**\n* *logLevel*: Specifies the \"level\" of the current log message. This can be either `LOG_LEVEL_DBG = 0`, `LOG_LEVEL_WRN = 1` or `LOG_LEVEL_ERR = 2`. The application may evaluate this value to filter the log messages according to their importance. Log messages of level `LOG_LEVEL_DBG` are for debugging purposes, log messages of level `LOG_LEVEL_WRN` indicate potential problems, and log messages of level `LOG_LEVEL_ERR` indicate serious errors.\n* *message*: The log message. This is a pointer to a buffer, which contains a NULL-terminated C string. The character encoding of the string is UTF-8. The application should regard this string buffer as *read-only*. Also, this buffer remains valid *only* until the callback function returns. Do **not** save a pointer to this buffer! If you need to retain the log message *after* the callback function returns, it must be *copied*, e.g. via ``strcpy()`` or ``strdup()``, into a *separate* buffer.\n\n\n\n# Source Code #\n\nThe source code of the Dynamic Audio Normalizer is available from one of the official [**Git**](http://git-scm.com/) repository mirrors:\n* ``https://github.com/lordmulder/DynamicAudioNormalizer.git`` &nbsp; ([Browse](https://github.com/lordmulder/DynamicAudioNormalizer))\n* ``https://bitbucket.org/muldersoft/dynamic-audio-normalizer.git`` &nbsp; ([Browse](https://bitbucket.org/muldersoft/dynamic-audio-normalizer/overview))\n* ``https://gitlab.com/dynamic-audio-normalizer/dynamic-audio-normalizer.git`` &nbsp; ([Browse](https://gitlab.com/dynamic-audio-normalizer/dynamic-audio-normalizer/tree/master))\n* ``https://git.assembla.com/dynamicaudionormalizer.git`` &nbsp; ([Browse](https://www.assembla.com/code/dynamicaudionormalizer/git/nodes))\n* ``https://muldersoft.codebasehq.com/dynamicaudionormalizer/dynamicaudionormalizer.git`` &nbsp; ([Browse](https://muldersoft.codebasehq.com/changelog/dynamicaudionormalizer/dynamicaudionormalizer))\n* ``https://repo.or.cz/DynamicAudioNormalizer.git`` &nbsp; ([Browse](http://repo.or.cz/w/DynamicAudioNormalizer.git))\n\n\n## Supported Build Environments ##\n\nThe following build environments are currently supported:\n\n* **Microsoft Windows** with Visual C++, tested with [*Visual Studio 2013*](http://www.visualstudio.com/) and [*Visual Studio 2015*](http://www.visualstudio.com/):\n\n    - You can build *Dynamic Audio Normalizer* by using the provided *solution* file: `DynamicAudioNormalizer.sln`\n\n    - Optionally, you may run the deployment script `z_build.bat`, which will build the application in various configurations also create deployment packages. Note that you may need to edit the paths in the build script first!\n\n    - Be sure that your environment variables `JAVA_HOME` (JDK path) and `QTDIR` (Qt4 path) are set correctly!\n\n* **Linux** with GCC/G++ and GNU Make, tested under [*Ubuntu 16.04 LTS*](https://www.ubuntu.com/) and [*openSUSE Leap 42.2*](https://www.opensuse.org/):\n\n    - You can build *Dynamic Audio Normalizer* by invoking the provided *Makefile* via `make` command. We assume that the essential build tools (*make*, *g++*, *libc*, etc), as contained in Debian's `build-essential` package, are installed.\n\n    - Optionally, you may pass the `MODE=no-gui` or `MODE=mininmal` options to Make in order to build the software *without* the GUI program or to create a *minimal* build (core library + CLI front-end only), respectively\n\n    - Be sure that your environment variables `JAVA_HOME` (JDK path) and `QTDIR` (Qt4 path) are set correctly!\n\n\n## Build Prerequisites ##\n\nBuilding the *Dynamic Audio Normalizer* requires some third-party tools and libraries:\n* [*POSIX Threads (PThreads)*](http://en.wikipedia.org/wiki/POSIX_Threads) is *always* required (on Windows use [*pthreads-w32*](https://www.sourceware.org/pthreads-win32/), by Ross P. Johnson)\n* [*libsndfile*](http://www.mega-nerd.com/libsndfile/), by Erik de Castro Lopo, is required for building the command-line program\n* [*libmpg123*](https://www.mpg123.de/), by Michael Hipp et al., is required for building the command-line program\n* [*Qt Framework*](http://qt-project.org/), by Qt Project, is required for building the log viewer GUI program (recommended version: Qt 4.x)\n* [*Java Develpment Kit (JDK)*](http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html), by Oracle, is required for building the JNI bindings (recommended version: JDK 8)\n* [*Ant*](http://ant.apache.org/), by Apache Software Foundation, is required for building the JNI bindings (recommended version: 1.9.x)\n* [*VST SDK v2.4*](http://www.steinberg.de/en/company/developer.html), by Steinberg GmbH, is required for building the VST plug-in (it's still included in the VST 3.x SDK!)\n* [*Winamp SDK*](http://forums.winamp.com/showthread.php?t=252090), by Nullsoft Inc, is required for building the Winamp plug-in (recommended version: 5.55)\n* [*Pandoc*](http://johnmacfarlane.net/pandoc/), by  John MacFarlane, is required for generating the HTML documentation\n* [*UPX*](http://upx.sourceforge.net/), by Markus Franz Xaver Johannes Oberhumer et al., is required for \"packing\" the libraries/executables\n\n### Windows ###\n\n**Windows** developers are recommended to download our pre-compiled \"all-in-one\" prerequisites package:\n* <https://sourceforge.net/projects/muldersoft/files/Prerequisites/>\n* <https://www.mediafire.com/folder/ygv9qoqv11kvk/Prerequisites>\n\n### Linux ###\n\n**Linux** developers install prerequisites via package manager. We give examples for [*Ubuntu*](https://www.ubuntu.com/), [*openSUSE*](https://www.opensuse.org/) and [*CentOS*](https://www.centos.org/) here:\n\n* **Ubuntu 16.04 LTS**:\n    * `sudo apt install build-essential`\n    * `sudo apt install openjdk-8-jdk python3-dev`\n    * `sudo apt install libsndfile-dev libmpg123-dev qt4-default`\n    * `sudo apt install ant pandoc wget`\n\n* **openSUSE Leap 42.2**:\n    * `sudo zypper install -t pattern devel_basis`\n    * `sudo zypper install gcc-c++ java-1_8_0-openjdk-devel python3-devel`\n    * `sudo zypper install libsndfile-devel mpg123-devel libqt4-devel`\n    * `sudo zypper install ant pandoc wget`\n    * ***Note:*** The [*mutlimedia:libs*](http://download.opensuse.org/repositories/multimedia:/color_management/openSUSE_Leap_42.2/) repository is required for the *mpg123-devel* package!\n\n* **CentOS/RHEL 7.3**:\n    * `sudo yum groupinstall \"Development Tools\"`\n    * `sudo yum install java-1.8.0-openjdk-devel python3-devel`\n    * `sudo yum install libsndfile-devel libmpg123-devel qt-devel`\n    * `sudo yum install ant pandoc wget`\n    * ***Note:*** The [*EPEL*](https://fedoraproject.org/wiki/EPEL) and [*Nux Dextop*](https://li.nux.ro/repos.html) repositories are required for some packages!\n\n\n\n# Changelog #\n\n## Version 2.11 (2019-01-03) ## {-}\n* Core library: Fixed a potential crash due to dereferencing a possibly invalidated iterator\n* Core library: Use C++11 `std::mutex`, if supported → removes the dependency PThread library\n* CLI front-end: Added support for decoding Opus input files via *libopusfile* library\n* CLI front-end: Added new CLI option `--output-bps` to specify the desired *output* bit-depth\n* Winamp plug-in: Some fixes and improvements; removed old workarounds\n* Windows binaries: Updated the included libsndfile version to 1.0.28 (2017-04-02)\n* Windows binaries: Updated build environment to Visual Studio 2017.9 (MSVC 14.16)\n\n## Version 2.10 (2017-04-14) ## {-}\n* Core library: Added `process()` function, i.e. an \"out-of-place\" version of `processInplace()`\n* Implemented [Python](https://www.python.org/) API → Dynamic Audio Normalizer can be used in, e .g., *Python*-based applications\n* CLI front-end: Added new CLI option `-t` to explicitly specify the desired *output* format\n* CLI front-end: Added new CLI option `-d` to explicitly specify the desired *input* library\n* CLI front-end: Added support for decoding input files via *libmpg123* library\n* CLI front-end: Implemented automatic/heuristic selection of the suitable *input* library\n* CLI front-end: Properly handle input files that provide more (or less) samples than what was projected\n* Windows binaries: Updated the included *libsndfile* version to 1.0.27 (2016-06-19)\n* Windows binaries: Updated build environment to Visual Studio 2015 (MSVC 14.0)\n\n## Version 2.09 (2016-08-01) ## {-}\n* Core library: Improved pre-filling code in order to avoid possible clipping at the very beginning\n\n## Version 2.08 (2015-01-20) ## {-}\n* CLI front-end: Very short files (shorter than Gaussian window size) are now handled properly\n* Core library: Fixed case when ``flushBuffer()`` is called *before* internal buffer is filled entirely\n* Core library: Workaround for the [*FMA3 bug*](https://connect.microsoft.com/VisualStudio/feedback/details/987093/x64-log-function-uses-vpsrlq-avx-instruction-without-regard-to-operating-system-so-it-crashes-on-vista-x64) in the Microsoft Visual C++ 2013 runtime libraries\n* Makefile: Various improvements\n\n## Version 2.07 (2014-11-01) ## {-}\n* Implemented [.NET](http://en.wikipedia.org/wiki/.NET_Framework) API → Dynamic Audio Normalizer can be used in, e .g., *C#*-based applications\n* Implemented [JNI](http://en.wikipedia.org/wiki/Java_Native_Interface) API → Dynamic Audio Normalizer can be used in *Java*-based  applications\n* Implemented [Pascal](http://en.wikipedia.org/wiki/Object_Pascal) API → Dynamic Audio Normalizer can be used in *Pascal*-based applications\n* Core library: Added new ``getConfiguration()`` API to retrieve the *active* configuration params\n* Core library: Fixed a bug that caused the gain factors to *not* progress as \"smoothly\" as intended\n\n## Version 2.06 (2014-09-22) ## {-}\n* Implemented [Winamp](http://www.winamp.com/) wrapper → Dynamic Audio Normalizer can now be used as Winamp plug-in\n* VST wrapper: Fixed potential audio corruptions due to the occasional insertion of \"silent\" samples\n* VST wrapper: Fixed a potential \"double free\" crash in the VST wrapper code\n* Core library: Fixed `reset()` API to actually work as expected (some state was *not* cleared before)\n* Core library: Make sure the number of delayed samples remains *constant* throughout the process\n\n## Version 2.05 (2014-09-10) ## {-}\n* Significant overhaul of the *compression* (thresholding) function\n* Implemented [VST](http://en.wikipedia.org/wiki/Virtual_Studio_Technology) wrapper → Dynamic Audio Normalizer can now be integrated in any VST host\n* Added *64-Bit* library and VST plug-in binaries to the Windows release packages\n* No longer use ``__declspec(thread)``, because it can crash libraries on Windows XP ([details](http://www.nynaeve.net/?p=187))\n\n## Version 2.04 (2014-08-25) ## {-}\n* Added an optional input *compression* (thresholding) function\n* Implemented [SoX](http://sox.sourceforge.net/) wrapper → Dynamic Audio Normalizer can now be used as a SoX effect\n* Improved internal handling of \"raw\" PCM data\n\n## Version 2.03 (2014-08-11) ## {-}\n* Implemented an *optional* RMS-based normalization mode\n* Added support for \"raw\" (headerless) audio data\n* Added pipeline support, i.e. reading from *stdin* or writing to *stdout*\n* Enabled FLAC/Vorbis support in the *static* Win32 binaries\n* Various fixes and minor improvements\n\n## Version 2.02 (2014-08-03) ## {-}\n* Update license → core library is now released under LGPL v2.1\n* Enabled FLAC *output* in the command-line program\n* Show legend in the log viewer program\n* Some minor documentation and build file updates\n* There are **no** code changes in the core library in this release\n\n## Version 2.01 (2014-08-01) ## {-}\n* Added graphical log viewer application to the distribution package\n* Improved the threshold function for the handling of the maximum gain factor limit\n* Added a new mode for handling the \"boundary\" frames (disabled by default)\n* Much improved the format of the log file\n\n## Version 2.00 (2014-07-26) ## {-}\n* Implemented a large lookahead buffer, which eliminates the need of 2-Pass processing\n* Dynamic Audio Normalizer now works with a *single* processing pass → results in up to 2× speed-up!\n* Removed the ``setPass()`` API, because it is *not* applicable any more\n* Added new ``flushBuffer()`` API, which provides a cleaner method of flushing the pending frames\n* Added new ``reset()`` API, which can be used to reset the internal state of the normalizer instance\n* Added new ``setLogFunction`` API, which can be used to set up a custom logging callback function\n* There should be **no** changes of the normalized audio output in this release whatsoever\n\n## Version 1.03 (2014-07-09) ## {-}\n* Added *static* library configuration to Visual Studio solution\n* Various compatibility fixes for Linux/GCC\n* Added Makefiles for Linux/GCC, tested under Ubuntu 14.04 LTS\n* There are **no** functional changes in this release\n\n## Version 1.02 (2014-07-06) ## {-}\n* First public release of the Dynamic Audio Normalizer.\n\n\n\n# Frequently Asked Questions (FAQ)\n\n## Q: How does DynAudNorm differ from dynamic range compression? ## {-}\n\nA traditional [*audio compressor*](http://en.wikipedia.org/wiki/Dynamic_range_compression) will prune all samples whose magnitude is above a certain threshold. In particular, the portion of the sample's magnitude that is above the pre-defined threshold will be reduced by a certain *ratio*, typically *2:1* or *4:1*. In other words, the signal *peaks* will be *flattened*, while all samples below the threshold are passed through unmodified. This leaves a certain \"headroom\", i.e. after flattening the signal peaks the maximum magnitude remaining in the *compressed* file will be lower than in the original. For example, if we apply *2:1* reduction to all samples above a threshold of *80%*, then the maximum remaining magnitude will be at *90%*, leaving a headroom of *10%*. After the compression has been applied, the resulting sample values will (usually) be amplified again, by a certain *fixed* gain factor. This factor will be chosen as high as possible *without* exceeding the maximum allowable signal level, similar to a traditional *normalizer*. Clearly, the compression allows for a much stronger amplification of the signal than what would be possible otherwise. However, due to the *flattening* of the signal peaks, the *dynamic range*, i.e. the ratio between the largest and smallest sample value, will be *reduced* significantly – which has a strong tendency to destroy the \"vividness\" of the audio signal! The excessive use of dynamic range compression in many recent productions is also known as the [\"loudness war\"](https://www.youtube.com/watch?v=3Gmex_4hreQ).\n\nThe following waveform view shows an audio signal prior to dynamic range compression (left), after the compression step (center) and after the subsequent amplification step (right). It can be seen that the original audio had a *large* dynamic range, with each drumbeat causing a significant peak. It can also be seen how those peeks have been *eliminated* for the most part after the compression. This makes the drum sound much *less* catchy! Last but not least, it can be seen that the final amplified audio now appears much \"louder\" than the original, but the dynamics are mostly gone…\n\n![Example of dynamic range compression](img/dyauno/Compression-2.png)\n\nIn contrast, the Dynamic Audio Normalizer also implements dynamic range compression *of some sort*, but it does **not** prune signal peaks above a *fixed* threshold. Actually it does **not** prune any signal peaks at all! Furthermore, it does **not** amplify the samples by a *fixed* gain factor. Instead, an \"optimal\" gain factor will be chosen for each *frame*. And, since a frame's gain factor is bounded by the highest magnitude sample within that frame, **100%** of the dynamic range will be preserved *within* each frame! The Dynamic Audio Normalizer only performs a \"dynamic range compression\" in the sense that the gain factors are *dynamically* adjusted over time, allowing \"quieter\" frames to get a stronger amplification than \"louder\" frames. This means that the volume differences between the \"quiet\" and the \"loud\" parts of an audio recording will be *harmonized* – but still the *full* dynamic range is being preserved within each of these parts. Finally, the Gaussian filter applied by the Dynamic Audio Normalizer ensures that any changes of the gain factor between neighbouring frames will be smooth and seamlessly, avoiding noticeable \"jumps\" of the audio volume.\n\n\n## Q: Why does DynAudNorm *not* seem to change my audio at all? ## {-}\n\nIf you think that the Dynamic Audio Normalizer is *not* working properly, because it (seemingly) did *not* change your audio at all, you are almost certainly having the *wrong* expectations and the Dynamic Audio Normalizer actually ***is*** working just as it is supposed to work! Please keep in mind, that the Dynamic Audio Normalizer does *not* use compression, by default, which means that all local \"peaks\" are perfectly preserved. Also, the Dynamic Audio Normalizer *never* amplifies your audio more than what would bring the \"loudest\" local peak up to the threshold, i.e. *no* peak is ever allowed to exceed the threshold. Furthermore &ndash; and that is the important part &ndash; the Dynamic Audio Normalizer does **not** simply amplify each *frame* to its local maximum! Instead, it employs a Gaussian filter in order to \"smooth\" the amplification factors between neighboring frames, which ensures natural volume transitions and avoids noticeable \"jumps\" of the volume. But this also means that, due to the Gaussian smoothing filter, a particular *frame* may (and often will!) be amplified **less** than what its *local* maximum would allow.\n\nConsequently, if the Dynamic Audio Normalizer did *not* change your audio in a noticeable way, it probably means that your audio simply could *not* be amplified any further &ndash; with the current Dynamic Audio Normalizer settings. This is **not** a \"problem\", it is just how the Dynamic Audio Normalizer is designed to work! Also keep in mind that the *default* settings of the Dynamic Audio Normalizer have been chosen rather \"conservative\", in order to make sure that the filter will *not* hurt the dynamics of the audio. Still, if you think that the Dynamic Audio Normalizer should be acting more \"aggressively\", you can try tweaking the settings. There are two settings that you may wish to adjust: Try a *smaller* [**filter size**](#gaussian-filter-window-size), or throw in some [**input compression**](#input-compression). The *smaller* the filter size, the *faster* (more aggressively) the filter is going to react. At the same time, *compression* may help to reduce \"outstanding\" peaks that prevent higher amplification, but too much compression may easily hurt audio quality!\n\n\n## Q: How to *not* harmonize the \"quiet\" and \"loud\" parts? ## {-}\n\nIf you do *not* want the \"quiet\" and the \"loud\" parts of your audio to be harmonized, then the Dynamic Audio Normalizer simply may *not* be the right tool for what you are trying to achieve. It was purposely designed to work like that. Nonetheless, by using a larger [filter size](#gaussian-filter-window-size), the Dynamic Audio Normalizer may be configured to act more similar to a \"traditional\" normalization filter.\n\n\n## Q: Why do I get audio reader warnings about more/less samples? ## {-}\n\nThis warning indicates that the audio reader delivered more/less audio samples than what was initially projected. For most file formats, the projected number of audio samples should be *accurate*, in which case the warning may actually indicate an I/O error. When processing MPEG audio files, however, the projected number of audio samples is only a *rough estimate*. That's because MPEG audio files, like `.mp2` or `.mp3` files, do **not** use a proper file format; they are just a \"loose\" collection of MPEG frames. Consequently, there is **no** way to accurately determine the number of samples in an MPEG audio file, except for decoding the *entire* file – which would be way too slow. That's why MPEG audio decoders, like ***libmpg123***, will try to *estimate* the total number of samples from the first couple of MPEG frames. Of course, this is **not** always accurate.\n\nConsequently, when working with MPEG audio files, the warning about more/less audio samples than what was initially projected being read from the input file is most likely **not** a reason for concern; the warning can safely be *ignored* in that case. But, if the warning occurs with *other* types of audio files, please take care, since there probably was an I/O error!\n\n*Note:* The Dynamic Audio Normalizer considers a discrepancy of the audio sample count of more than *25%* as critical error.\n\n\n## Q: Why does the program crash with GURU MEDITATION error? ## {-}\n\nThis error message indicates that the program has encountered a serious problem. On possible reason is that your processor does **not** support the [SSE2](http://en.wikipedia.org/wiki/SSE2) instruction set. That's because the official Dynamic Audio Normalizer binaries have been compiled with SSE and SSE2 code enabled – like pretty much any compiler does *by default* nowadays. So without SSE2 support, the program cannot run, obviosuly. This can be fixed either by upgrading your system to a less antiquated processor, or by recompiling Dynamic Audio Normalizer from the sources with SSE2 code generation *disabled*. Note that SSE2 is supported by the Pentium 4 and Athon 64 processors as well as **all** later processors. Also *every* 64-Bit supports SSE2, because [x86-64](http://en.wikipedia.org/wiki/X86-64) has adopted SSE2 as \"core\" instructions. That means that *every processor from the last decade* almost certainly supports SSE2.\n\nIf your processor *does* support SSE2, but you still get the above error message, you probably have found a bug. In this case it is highly recommended to create a *debug build* and use a [debugger](http://en.wikipedia.org/wiki/Debugger) in order to track down the cause of the problem.\n\n\n# License Terms #\n\nThis chapter lists the licenses that apply to the individual components of the Dynamic Audio Normalizer software.\n\n\n## Dynamic Audio Normalizer Library ##\n\nThe Dynamic Audio Normalizer **library** (DynamicAudioNormalizerAPI) is released under the  \n***GNU Lesser General Public License, Version 2.1***.\n\n\tDynamic Audio Normalizer - Audio Processing Library\n\tCopyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n\t\n\tThis library is free software; you can redistribute it and/or\n\tmodify it under the terms of the GNU Lesser General Public\n\tLicense as published by the Free Software Foundation; either\n\tversion 2.1 of the License, or (at your option) any later version.\n\t\n\tThis library is distributed in the hope that it will be useful,\n\tbut WITHOUT ANY WARRANTY; without even the implied warranty of\n\tMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n\tLesser General Public License for more details.\n\t\n\tYou should have received a copy of the GNU Lesser General Public\n\tLicense along with this library; if not, write to the Free Software\n\tFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n\n<http://www.gnu.org/licenses/lgpl-2.1.html>\n\n\n## Dynamic Audio Normalizer CLI ##\n\nThe Dynamic Audio Normalizer **command-line program** (DynamicAudioNormalizerCLI) is released under the  \n***GNU General Public License, Version 2***.\n\n\tDynamic Audio Normalizer - Audio Processing Utility\n\tCopyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n\t\n\tThis program is free software; you can redistribute it and/or\n\tmodify it under the terms of the GNU General Public License\n\tas published by the Free Software Foundation; either version 2\n\tof the License, or (at your option) any later version.\n\t\n\tThis program is distributed in the hope that it will be useful,\n\tbut WITHOUT ANY WARRANTY; without even the implied warranty of\n\tMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n\tGNU General Public License for more details.\n\t\n\tYou should have received a copy of the GNU General Public License\n\talong with this program; if not, write to the Free Software\n\tFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n\n\n<http://www.gnu.org/licenses/gpl-2.0.html>\n\n\n## Dynamic Audio Normalizer GUI ##\n\nThe Dynamic Audio Normalizer **log viewer program** (DynamicAudioNormalizerGUI) is released under the  \n***GNU General Public License, Version 3***.\n\n\tDynamic Audio Normalizer - Audio Processing Utility\n\tCopyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n\t\n\tThis program is free software: you can redistribute it and/or modify\n\tit under the terms of the GNU General Public License as published by\n\tthe Free Software Foundation, either version 3 of the License, or\n\t(at your option) any later version.\n\t\n\tThis program is distributed in the hope that it will be useful,\n\tbut WITHOUT ANY WARRANTY; without even the implied warranty of\n\tMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n\tGNU General Public License for more details.\n\t\n\tYou should have received a copy of the GNU General Public License\n\talong with this program.  If not, see <http://www.gnu.org/licenses/>.\n\n<http://www.gnu.org/licenses/gpl-3.0.html>\n\n\n## Dynamic Audio Normalizer Plug-In Wrapper ##\n\nThe Dynamic Audio Normalizer **plug-in** wrappers for *SoX*, *VST* and *Winamp* are released under the  \n***MIT/X11 License***.\n\n\tDynamic Audio Normalizer - Audio Processing Utility\n\tCopyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.\n\t\n\tPermission is hereby granted, free of charge, to any person obtaining a copy\n\tof this software and associated documentation files (the \"Software\"), to deal\n\tin the Software without restriction, including without limitation the rights\n\tto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\tcopies of the Software, and to permit persons to whom the Software is\n\tfurnished to do so, subject to the following conditions:\n\t\n\tThe above copyright notice and this permission notice shall be included in\n\tall copies or substantial portions of the Software.\n\t\n\tTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\tIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\tFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\tAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\tLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\tOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\tTHE SOFTWARE.\n\n<http://opensource.org/licenses/MIT>\n\n\n\n# Acknowledgement #\n\nThe Dynamic Audio Normalizer **CLI program** (DynamicAudioNormalizerCLI) incorporates the following *third-party* software:\n\n* [**libsndfile**](http://www.mega-nerd.com/libsndfile/)  \n  C library for reading and writing files containing sampled sound through one standard library interface  \n  Copyright (C) 1999-2016 Erik de Castro Lopo\n  *Applicable license:* GNU Lesser General Public License, Version 2.1\n  \n* [**libmpg123**]()  \n  C library for decoding of MPEG 1.0/2.0/2.5 layer I/II/III audio streams to interleaved PCM  \n  Copyright (C) 1995-2016 by Michael Hipp, Thomas Orgis, Patrick Dehne, Jonathan Yong and others.  \n  *Applicable license:* GNU Lesser General Public License, Version 2.1\n\nThe Dynamic Audio Normalizer **log viewer** (DynamicAudioNormalizerGUI) incorporates the following *third-party* software:\n\n* [**Qt Framework**](http://qt-project.org/)  \n  Cross-platform application and UI framework for developers using C++ or QML, a CSS & JavaScript like language  \n  Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies)  \n  *Applicable license:* GNU Lesser General Public License, Version 2.1\n  \n* [**QCustomPlot**](http://www.qcustomplot.com/)  \n  Qt C++ widget for plotting and data visualization that focuses on making good looking, publication quality 2D plots  \n  Copyright (C) 2011-2014 Emanuel Eichhammer  \n  *Applicable license:* GNU General Public License, Version 3\n\nThe Dynamic Audio Normalizer **VST wrapper** (DynamicAudioNormalizerVST) incorporates the following *third-party* software:\n\n* [**Spooky Hash V2**](http://burtleburtle.net/bob/hash/spooky.html)  \n  Public domain noncryptographic hash function producing well-distributed 128-bit hash values  \n  Created by Bob Jenkins, 2012.  \n  *Applicable license:* None / Public Domain\n\nThe Dynamic Audio Normalizer can operate as a **plug-in** (effect) using the following *third-party* technologies:\n\n  * [**Sound eXchange**](http://sox.sourceforge.net/)  \n  Cross-platform command line utility that can convert various formats of computer audio files in to other formats  \n  Copyright (C) 1998-2009 Chris Bagwell and SoX contributors\n\n  * [**Virtual Studio Technology (VST 2.x)**](http://en.wikipedia.org/wiki/Virtual_Studio_Technology)  \n  Software interface that integrates software audio synthesizer and effect Plug-ins with audio editors and recording systems.  \n  Copyright (C) 2006 Steinberg Media Technologies. All Rights Reserved.  \n  <small>**VST PlugIn Interface Technology by Steinberg Media Technologies GmbH. VST is a trademark of Steinberg Media Technologies GmbH.**</small>\n\n  * [**Winamp**](http://www.winamp.com/)  \n  Popular media player for Windows, Android, and OS X that supports extensibility with plug-ins and skins.  \n  Copyright (C) 1997-2013 Nullsoft, Inc. All Rights Reserved.  \n\n\n&nbsp;  \n&nbsp;  \n\ne.o.f.\n"
  },
  {
    "path": "etc/vst_sdk/VST_SDK_INFO.txt",
    "content": "VST SDK Installation Instructions\n=================================\n\nPlease put the VST SDK files (v2.4) into this directory.\n\nThese files are NOT redistributed for legal reasons, but can be downloaded from the Steinberg web-site:\nhttp://www.steinberg.net/en/company/developers.html\n\nAfter you have extracted the VST SDK files (v2.4), there should be *two* sub-directories inside the \"vst_sdk\" directory:\n(1) \"pluginterfaces\"\n(2) \"public.sdk\"\n\nNote that VST v3.x is not currently used or supported, however the v3.x SDK also includes the required v2.4 files.\n\n\nAcknowledgement:\n----------------\n\n(1) VST PlugIn Interface Technology by Steinberg Media Technologies GmbH.\n(2) VST is a trademark of Steinberg Media Technologies GmbH.\n"
  },
  {
    "path": "etc/winamp_sdk/LICENSE.txt",
    "content": "Copyright 1999-2001 Nullsoft, Inc.\n\n  This software is provided 'as-is', without any express or implied\n  warranty.  In no event will the authors be held liable for any damages\n  arising from the use of this software.\n\n  Permission is granted to anyone to use this software for any purpose,\n  including commercial applications, and to alter it and redistribute it\n  freely, subject to the following restrictions:\n\n  1. The origin of this software must not be misrepresented; you must not\n     claim that you wrote the original software. If you use this software\n     in a product, an acknowledgment in the product documentation would be\n     appreciated but is not required.\n  2. Altered source versions must be plainly marked as such, and must not be\n     misrepresented as being the original software.\n  3. This notice may not be removed or altered from any source distribution.\n\n\nBrennan Underwood\nbrennan@nullsoft.com\n"
  },
  {
    "path": "etc/winamp_sdk/include/winamp_dsp.h",
    "content": "#ifndef NULLSOFT_WINAMP_DSP_H\n#define NULLSOFT_WINAMP_DSP_H\n// DSP plugin interface\n\n// notes:\n// any window that remains in foreground should optimally pass unused\n// keystrokes to the parent (winamp's) window, so that the user\n// can still control it. As for storing configuration,\n// Configuration data should be stored in <dll directory>\\plugin.ini\n// (look at the vis plugin for configuration code)\n\ntypedef struct winampDSPModule {\n  char *description;\t\t// description\n  HWND hwndParent;\t\t\t// parent window (filled in by calling app)\n  HINSTANCE hDllInstance;\t// instance handle to this DLL (filled in by calling app)\n\n  void (*Config)(struct winampDSPModule *this_mod);  // configuration dialog (if needed)\n  int (*Init)(struct winampDSPModule *this_mod);     // 0 on success, creates window, etc (if needed)\n\n  // modify waveform samples: returns number of samples to actually write\n  // (typically numsamples, but no more than twice numsamples, and no less than half numsamples)\n  // numsamples should always be at least 128. should, but I'm not sure\n  int (*ModifySamples)(struct winampDSPModule *this_mod, short int *samples, int numsamples, int bps, int nch, int srate);\n\t\t\t\n  void (*Quit)(struct winampDSPModule *this_mod);    // called when unloading\n\n  void *userData; // user data, optional\n} winampDSPModule;\n\ntypedef struct {\n  int version;       // DSP_HDRVER\n  char *description; // description of library\n  winampDSPModule* (*getModule)(int);\t// module retrieval function\n  int (*sf)(int key); // DSP_HDRVER == 0x21\n} winampDSPHeader;\n\n// exported symbols\n#ifdef USE_DSP_HDR_HWND\ntypedef winampDSPHeader* (*winampDSPGetHeaderType)(HWND);\n#define DSP_HDRVER 0x22\n\n#else\n\ntypedef winampDSPHeader* (*winampDSPGetHeaderType)(HWND);\n// header version: 0x20 == 0.20 == winamp 2.0\n#define DSP_HDRVER 0x20\n#endif\n\n// return values from the winampUninstallPlugin(HINSTANCE hdll, HWND parent, int param)\n// which determine if we can uninstall the plugin immediately or on winamp restart\n#define DSP_PLUGIN_UNINSTALL_NOW    0x0\n#define DSP_PLUGIN_UNINSTALL_REBOOT 0x1\n//\n// uninstall support was added from 5.0+ and uninstall now support from 5.5+\n// it is down to you to ensure that if uninstall now is returned that it will not cause a crash\n// (ie don't use if you've been subclassing the main window)\n\n// Version note:\n//\n// Added passing of Winamp's main hwnd in the call to the exported winampDSPHeader()\n// which allows for primarily the use of localisation features with the bundled plugins.\n// If you want to use the new version then either you can edit you version of dsp.h or\n// you can add USE_DSP_HDR_HWND to your project's defined list or before use of dsp.h\n//\n#endif"
  },
  {
    "path": "etc/winamp_sdk/include/winamp_ipc.h",
    "content": "/*\n** Copyright (C) 1997-2008 Nullsoft, Inc.\n**\n** This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held \n** liable for any damages arising from the use of this software. \n**\n** Permission is granted to anyone to use this software for any purpose, including commercial applications, and to \n** alter it and redistribute it freely, subject to the following restrictions:\n**\n**   1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. \n**      If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.\n**\n**   2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.\n**\n**   3. This notice may not be removed or altered from any source distribution.\n**\n*/\n\n#ifndef _WA_IPC_H_\n#define _WA_IPC_H_\n\n#include <windows.h>\n#include <stddef.h>\n#if (_MSC_VER <= 1200)\ntypedef int intptr_t;\n#endif\n/*\n** This is the modern replacement for the classic 'frontend.h'. Most of these \n** updates are designed for in-process use, i.e. from a plugin.\n**\n*/\n\n/* Most of the IPC_* messages involve sending the message in the form of:\n** result = SendMessage(hwnd_winamp,WM_WA_IPC,(parameter),IPC_*);\n** Where different then this is specified (typically with WM_COPYDATA variants)\n**\n** When you use SendMessage(hwnd_winamp,WM_WA_IPC,(parameter),IPC_*) and specify a IPC_*\n** which is not currently implemented/supported by the Winamp version being used then it\n** will return 1 for 'result'. This is a good way of helping to check if an api being\n** used which returns a function pointer, etc is even going to be valid.\n*/\n\n#define WM_WA_IPC WM_USER\n\n#define WINAMP_VERSION_MAJOR(winampVersion) ((winampVersion & 0x0000FF00) >> 12)\n#define WINAMP_VERSION_MINOR(winampVersion) (winampVersion & 0x000000FF)  // returns, i.e. 0x12 for 5.12 and 0x10 for 5.1... \n\n\n#define IPC_GETVERSION 0\n/* int version = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVERSION);\n**\n** The version returned will be 0x20yx for Winamp 2.yx.\n** Versions previous to Winamp 2.0 typically (but not always) use 0x1zyx for 1.zx.\n** Just a bit weird but that's the way it goes.\n**\n** For Winamp 5.x it uses the format 0x50yx for Winamp 5.yx\n** e.g.   5.01 -> 0x5001\n**        5.09 -> 0x5009\n**        5.1  -> 0x5010\n**\n** Notes: For 5.02 this api will return the same value as for a 5.01 build.\n**        For 5.07 this api will return the same value as for a 5.06 build.\n*/\n\n\n#define IPC_GETVERSIONSTRING 1\n\n\n#define IPC_GETREGISTEREDVERSION 770\n/* (requires Winamp 5.0+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETREGISTEREDVERSION);\n**\n** This will open the Winamp Preferences and show the Winamp Pro page.\n*/\n\n\ntypedef struct {\n  const char *filename;\n  const char *title;\n  int length;\n} enqueueFileWithMetaStruct; // send this to a IPC_PLAYFILE in a non WM_COPYDATA, \n// and you get the nice desired result. if title is NULL, it is treated as a \"thing\",\n// otherwise it's assumed to be a file (for speed)\n\ntypedef struct {\n  const wchar_t *filename;\n  const wchar_t *title;\n  int length;\n} enqueueFileWithMetaStructW;\n\n#define IPC_PLAYFILE 100  // dont be fooled, this is really the same as enqueufile\n#define IPC_ENQUEUEFILE 100 \n#define IPC_PLAYFILEW 1100\n#define IPC_ENQUEUEFILEW 1100\n/* This is sent as a WM_COPYDATA with IPC_PLAYFILE as the dwData member and the string\n** of the file / playlist to be enqueued into the playlist editor as the lpData member.\n** This will just enqueue the file or files since you can use this to enqueue a playlist.\n** It will not clear the current playlist or change the playback state.\n**\n** COPYDATASTRUCT cds = {0};\n**   cds.dwData = IPC_ENQUEUEFILE;\n**   cds.lpData = (void*)\"c:\\\\test\\\\folder\\\\test.mp3\";\n**   cds.cbData = lstrlen((char*)cds.lpData)+1;  // include space for null char\n**   SendMessage(hwnd_winamp,WM_COPYDATA,0,(LPARAM)&cds);\n**\n**\n** With 2.9+ and all of the 5.x versions you can send this as a normal WM_WA_IPC\n** (non WM_COPYDATA) with an enqueueFileWithMetaStruct as the param.\n** If the title member is null then it is treated as a \"thing\" otherwise it will be\n** assumed to be a file (for speed).\n**\n** enqueueFileWithMetaStruct eFWMS = {0};\n**   eFWMS.filename = \"c:\\\\test\\\\folder\\\\test.mp3\";\n**   eFWMS.title = \"Whipping Good\";\n**   eFWMS.length = 300;  // this is the number of seconds for the track\n**   SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)&eFWMS,IPC_ENQUEUEFILE);\n*/\n\n\n#define IPC_DELETE 101\n#define IPC_DELETE_INT 1101 \n/* SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_DELETE);\n** Use this api to clear Winamp's internal playlist.\n** You should not need to use IPC_DELETE_INT since it is used internally by Winamp when\n** it is dealing with some lame Windows Explorer issues (hard to believe that!).\n*/\n\n\n#define IPC_STARTPLAY 102   \n#define IPC_STARTPLAY_INT 1102 \n/* SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_STARTPLAY);\n** Sending this will start playback and is almost the same as hitting the play button.\n** The IPC_STARTPLAY_INT version is used internally and you should not need to use it\n** since it won't be any fun.\n*/\n\n\n#define IPC_CHDIR 103\n/* This is sent as a WM_COPYDATA type message with IPC_CHDIR as the dwData value and the\n** directory you want to change to as the lpData member.\n**\n** COPYDATASTRUCT cds = {0};\n**   cds.dwData = IPC_CHDIR;\n**   cds.lpData = (void*)\"c:\\\\download\";\n**   cds.cbData = lstrlen((char*)cds.lpData)+1; // include space for null char\n**   SendMessage(hwnd_winamp,WM_COPYDATA,0,(LPARAM)&cds);\n**\n** The above example will make Winamp change to the directory 'C:\\download'.\n*/\n\n\n#define IPC_ISPLAYING 104\n/* int res = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISPLAYING);\n** This is sent to retrieve the current playback state of Winamp.\n** If it returns 1, Winamp is playing.\n** If it returns 3, Winamp is paused.\n** If it returns 0, Winamp is not playing.\n*/\n\n\n#define IPC_GETOUTPUTTIME 105\n/* int res = SendMessage(hwnd_winamp,WM_WA_IPC,mode,IPC_GETOUTPUTTIME);\n** This api can return two different sets of information about current playback status.\n**\n** If mode = 0 then it will return the position (in ms) of the currently playing track.\n** Will return -1 if Winamp is not playing.\n**\n** If mode = 1 then it will return the current track length (in seconds).\n** Will return -1 if there are no tracks (or possibly if Winamp cannot get the length).\n**\n** If mode = 2 then it will return the current track length (in milliseconds).\n** Will return -1 if there are no tracks (or possibly if Winamp cannot get the length).\n*/\n\n\n#define IPC_JUMPTOTIME 106\n/* (requires Winamp 1.60+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,ms,IPC_JUMPTOTIME);\n** This api sets the current position (in milliseconds) for the currently playing song.\n** The resulting playback position may only be an approximate time since some playback\n** formats do not provide exact seeking e.g. mp3\n** This returns -1 if Winamp is not playing, 1 on end of file, or 0 if it was successful.\n*/\n\n\n#define IPC_GETMODULENAME 109\n#define IPC_EX_ISRIGHTEXE 666\n/* usually shouldnt bother using these, but here goes:\n** send a WM_COPYDATA with IPC_GETMODULENAME, and an internal\n** flag gets set, which if you send a normal WM_WA_IPC message with\n** IPC_EX_ISRIGHTEXE, it returns whether or not that filename\n** matches. lame, I know.\n*/\n\n\n#define IPC_WRITEPLAYLIST 120\n/* (requires Winamp 1.666+)\n** int cur = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_WRITEPLAYLIST);\n**\n** IPC_WRITEPLAYLIST will write the current playlist to '<winampdir>\\\\Winamp.m3u' and\n** will also return the current playlist position (see IPC_GETLISTPOS).\n**\n** This is kinda obsoleted by some of the newer 2.x api items but it still is good for\n** use with a front-end program (instead of a plug-in) and you want to see what is in the\n** current playlist.\n**\n** This api will only save out extended file information in the #EXTINF entry if Winamp\n** has already read the data such as if the file was played of scrolled into view. If\n** Winamp has not read the data then you will only find the file with its filepath entry\n** (as is the base requirements for a m3u playlist).\n*/\n\n\n#define IPC_SETPLAYLISTPOS 121\n/* (requires Winamp 2.0+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,position,IPC_SETPLAYLISTPOS)\n** IPC_SETPLAYLISTPOS sets the playlist position to the specified 'position'.\n** It will not change playback status or anything else. It will just set the current\n** position in the playlist and will update the playlist view if necessary.\n**\n** If you use SendMessage(hwnd_winamp,WM_COMMAND,MAKEWPARAM(WINAMP_BUTTON2,0),0);\n** after using IPC_SETPLAYLISTPOS then Winamp will start playing the file at 'position'.\n*/\n\n\n#define IPC_SETVOLUME 122\n/* (requires Winamp 2.0+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,volume,IPC_SETVOLUME);\n** IPC_SETVOLUME sets the volume of Winamp (between the range of 0 to 255).\n**\n** If you pass 'volume' as -666 then the message will return the current volume.\n** int curvol = SendMessage(hwnd_winamp,WM_WA_IPC,-666,IPC_SETVOLUME);\n*/\n\n\n#define IPC_GETVOLUME(hwnd_winamp) SendMessage(hwnd_winamp,WM_WA_IPC,-666,IPC_SETVOLUME)\n/* (requires Winamp 2.0+)\n** int curvol = IPC_GETVOLUME(hwnd_winamp);\n** This will return the current volume of Winamp or \n*/\n\n\n#define IPC_SETPANNING 123\n/* (requires Winamp 2.0+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,panning,IPC_SETPANNING);\n** IPC_SETPANNING sets the panning of Winamp from 0 (left) to 255 (right).\n**\n** At least in 5.x+ this works from -127 (left) to 127 (right).\n**\n** If you pass 'panning' as -666 to this api then it will return the current panning.\n** int curpan = SendMessage(hwnd_winamp,WM_WA_IPC,-666,IPC_SETPANNING);\n*/\n\n\n#define IPC_GETLISTLENGTH 124\n/* (requires Winamp 2.0+)\n** int length = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTLENGTH);\n** IPC_GETLISTLENGTH returns the length of the current playlist as the number of tracks.\n*/\n\n\n#define IPC_GETLISTPOS 125\n/* (requires Winamp 2.05+)\n** int pos=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTPOS);\n** IPC_GETLISTPOS returns the current playlist position (which is shown in the playlist\n** editor as a differently coloured text entry e.g is yellow for the classic skin).\n**\n** This api is a lot like IPC_WRITEPLAYLIST but a lot faster since it does not have to\n** write out the whole of the current playlist first.\n*/\n\n\n#define IPC_GETINFO 126\n/* (requires Winamp 2.05+)\n** int inf=SendMessage(hwnd_winamp,WM_WA_IPC,mode,IPC_GETINFO);\n** IPC_GETINFO returns info about the current playing song. The value\n** it returns depends on the value of 'mode'.\n** Mode      Meaning\n** ------------------\n** 0         Samplerate, in kilohertz (i.e. 44)\n** 1         Bitrate  (i.e. 128)\n** 2         Channels (i.e. 2)\n** 3 (5+)    Video LOWORD=w HIWORD=h\n** 4 (5+)    > 65536, string (video description)\n** 5 (5.25+) Samplerate, in hertz (i.e. 44100)\n*/\n\n\n#define IPC_GETEQDATA 127\n/* (requires Winamp 2.05+)\n** int data=SendMessage(hwnd_winamp,WM_WA_IPC,pos,IPC_GETEQDATA);\n** IPC_GETEQDATA queries the status of the EQ. \n** The value returned depends on what 'pos' is set to:\n** Value      Meaning\n** ------------------\n** 0-9        The 10 bands of EQ data. 0-63 (+20db - -20db)\n** 10         The preamp value. 0-63 (+20db - -20db)\n** 11         Enabled. zero if disabled, nonzero if enabled.\n** 12         Autoload. zero if disabled, nonzero if enabled.\n*/\n\n\n#define IPC_SETEQDATA 128\n/* (requires Winamp 2.05+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,pos,IPC_GETEQDATA);\n** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SETEQDATA);\n** IPC_SETEQDATA sets the value of the last position retrieved\n** by IPC_GETEQDATA. This is pretty lame, and we should provide\n** an extended version that lets you do a MAKELPARAM(pos,value).\n** someday...\n\n  new (2.92+): \n    if the high byte is set to 0xDB, then the third byte specifies\n    which band, and the bottom word specifies the value.\n*/\n\n\n#define IPC_ADDBOOKMARK 129\n#define IPC_ADDBOOKMARKW 131\n/* (requires Winamp 2.4+)\n** This is sent as a WM_COPYDATA using IPC_ADDBOOKMARK as the dwData value and the\n** directory you want to change to as the lpData member. This will add the specified\n** file / url to the Winamp bookmark list.\n**\n** COPYDATASTRUCT cds = {0};\n**   cds.dwData = IPC_ADDBOOKMARK;\n**   cds.lpData = (void*)\"http://www.blah.com/listen.pls\";\n**   cds.cbData = lstrlen((char*)cds.lpData)+1; // include space for null char\n**   SendMessage(hwnd_winamp,WM_COPYDATA,0,(LPARAM)&cds);\n**\n**\n** In Winamp 5.0+ we use this as a normal WM_WA_IPC and the string is null separated as\n** the filename and then the title of the entry.\n**\n** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)(char*)\"filename\\0title\\0\",IPC_ADDBOOKMARK);\n**\n** This will notify the library / bookmark editor that a bookmark was added.\n** Note that using this message in this context does not actually add the bookmark.\n** Do not use, it is essentially just a notification type message :)\n*/\n\n\n#define IPC_INSTALLPLUGIN 130\n/* This is not implemented (and is very unlikely to be done due to safety concerns).\n** If it was then you could do a WM_COPYDATA with a path to a .wpz and it would then\n** install the plugin for you.\n**\n** COPYDATASTRUCT cds = {0};\n**   cds.dwData = IPC_INSTALLPLUGIN;\n**   cds.lpData = (void*)\"c:\\\\path\\\\to\\\\file.wpz\";\n**   cds.cbData = lstrlen((char*)cds.lpData)+1; // include space for null char\n**   SendMessage(hwnd_winamp,WM_COPYDATA,0,(LPARAM)&cds);\n*/\n\n\n#define IPC_RESTARTWINAMP 135\n/* (requires Winamp 2.2+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_RESTARTWINAMP);\n** IPC_RESTARTWINAMP will restart Winamp (isn't that obvious ? :) )\n** If this fails to make Winamp start after closing then there is a good chance one (or\n** more) of the currently installed plugins caused Winamp to crash on exit (either as a\n** silent crash or a full crash log report before it could call itself start again.\n*/\n\n\n#define IPC_ISFULLSTOP 400\n/* (requires winamp 2.7+ I think)\n** int ret=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISFULLSTOP);\n** This is useful for when you're an output plugin and you want to see if the stop/close\n** happening is a full stop or if you are just between tracks. This returns non zero if\n** it is a full stop or zero if it is just a new track.\n** benski> i think it's actually the other way around - \n**         !0 for EOF and 0 for user pressing stop\n*/\n\n\n#define IPC_INETAVAILABLE 242\n/* (requires Winamp 2.05+)\n** int val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_INETAVAILABLE);\n** IPC_INETAVAILABLE will return 1 if an Internet connection is available for Winamp and\n** relates to the internet connection type setting on the main general preferences page\n** in the Winamp preferences.\n*/\n\n\n#define IPC_UPDTITLE 243\n/* (requires Winamp 2.2+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_UPDTITLE);\n** IPC_UPDTITLE will ask Winamp to update the information about the current title and\n** causes GetFileInfo(..) in the input plugin associated with the current playlist entry\n** to be called. This can be called such as when an input plugin is buffering a file so\n** that it can cause the buffer percentage to appear in the playlist.\n*/\n\n\n#define IPC_REFRESHPLCACHE 247\n/* (requires Winamp 2.2+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_REFRESHPLCACHE);\n** IPC_REFRESHPLCACHE will flush the playlist cache buffer and you send this if you want\n** Winamp to go refetch the titles for all of the entries in the current playlist.\n**\n** 5.3+: pass a wchar_t * string in wParam, and it'll do a strnicmp() before clearing the cache\n*/\n\n\n#define IPC_GET_SHUFFLE 250\n/* (requires Winamp 2.4+)\n** int val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_SHUFFLE);\n** IPC_GET_SHUFFLE returns the status of the shuffle option.\n** If set then it will return 1 and if not set then it will return 0.\n*/\n\n\n#define IPC_GET_REPEAT 251\n/* (requires Winamp 2.4+)\n** int val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_REPEAT);\n** IPC_GET_REPEAT returns the status of the repeat option.\n** If set then it will return 1 and if not set then it will return 0.\n*/\n\n\n#define IPC_SET_SHUFFLE 252\n/* (requires Winamp 2.4+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SET_SHUFFLE);\n** IPC_SET_SHUFFLE sets the status of the shuffle option.\n** If 'value' is 1 then shuffle is turned on.\n** If 'value' is 0 then shuffle is turned off.\n*/\n\n\n#define IPC_SET_REPEAT 253\n/* (requires Winamp 2.4+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SET_REPEAT);\n** IPC_SET_REPEAT sets the status of the repeat option.\n** If 'value' is 1 then shuffle is turned on.\n** If 'value' is 0 then shuffle is turned off.\n*/\n\n\n#define IPC_ENABLEDISABLE_ALL_WINDOWS 259 // 0xdeadbeef to disable\n/* (requires Winamp 2.9+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,(enable?0:0xdeadbeef),IPC_ENABLEDISABLE_ALL_WINDOWS);\n** Sending this message with 0xdeadbeef as the param will disable all winamp windows and\n** any other values will enable all of the Winamp windows again. When disabled you won't\n** get any response on clicking or trying to do anything to the Winamp windows. If the\n** taskbar icon is shown then you may still have control ;)\n*/\n\n\n#define IPC_GETWND 260\n/* (requires Winamp 2.9+)\n** HWND h=SendMessage(hwnd_winamp,WM_WA_IPC,IPC_GETWND_xxx,IPC_GETWND);\n** returns the HWND of the window specified.\n*/\n  #define IPC_GETWND_EQ 0 // use one of these for the param\n  #define IPC_GETWND_PE 1\n  #define IPC_GETWND_MB 2\n  #define IPC_GETWND_VIDEO 3\n#define IPC_ISWNDVISIBLE 261 // same param as IPC_GETWND\n\n\n/************************************************************************\n***************** in-process only (WE LOVE PLUGINS)\n************************************************************************/\n\n#define IPC_SETSKINW 199\n#define IPC_SETSKIN 200\n/* (requires Winamp 2.04+, only usable from plug-ins (not external apps))\n** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)\"skinname\",IPC_SETSKIN);\n** IPC_SETSKIN sets the current skin to \"skinname\". Note that skinname \n** can be the name of a skin, a skin .zip file, with or without path. \n** If path isn't specified, the default search path is the winamp skins \n** directory.\n*/\n\n\n#define IPC_GETSKIN 201\n#define IPC_GETSKINW 1201\n/* (requires Winamp 2.04+, only usable from plug-ins (not external apps))\n** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)skinname_buffer,IPC_GETSKIN);\n** IPC_GETSKIN puts the directory where skin bitmaps can be found \n** into  skinname_buffer.\n** skinname_buffer must be MAX_PATH characters in length.\n** When using a .zip'd skin file, it'll return a temporary directory\n** where the ZIP was decompressed.\n*/\n\n\n#define IPC_EXECPLUG 202\n/* (requires Winamp 2.04+, only usable from plug-ins (not external apps))\n** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)\"vis_file.dll\",IPC_EXECPLUG);\n** IPC_EXECPLUG executes a visualization plug-in pointed to by WPARAM.\n** the format of this string can be:\n** \"vis_whatever.dll\"\n** \"vis_whatever.dll,0\" // (first mod, file in winamp plug-in dir)\n** \"C:\\\\dir\\\\vis_whatever.dll,1\" \n*/\n\n\n#define IPC_GETPLAYLISTFILE 211\n#define IPC_GETPLAYLISTFILEW 214\n/* (requires Winamp 2.04+, only usable from plug-ins (not external apps))\n** char *name=SendMessage(hwnd_winamp,WM_WA_IPC,index,IPC_GETPLAYLISTFILE);\n** IPC_GETPLAYLISTFILE gets the filename of the playlist entry [index].\n** returns a pointer to it. returns NULL on error.\n*/\n\n\n#define IPC_GETPLAYLISTTITLE 212\n#define IPC_GETPLAYLISTTITLEW 213\n/* (requires Winamp 2.04+, only usable from plug-ins (not external apps))\n** char *name=SendMessage(hwnd_winamp,WM_WA_IPC,index,IPC_GETPLAYLISTTITLE);\n**\n** IPC_GETPLAYLISTTITLE gets the title of the playlist entry [index].\n** returns a pointer to it. returns NULL on error.\n*/\n\n\n#define IPC_GETHTTPGETTER 240\n/* retrieves a function pointer to a HTTP retrieval function.\n** if this is unsupported, returns 1 or 0.\n** the function should be:\n** int (*httpRetrieveFile)(HWND hwnd, char *url, char *file, char *dlgtitle);\n** if you call this function, with a parent window, a URL, an output file, and a dialog title,\n** it will return 0 on successful download, 1 on error.\n*/\n\n\n#define IPC_GETHTTPGETTERW 1240\n/* int (*httpRetrieveFileW)(HWND hwnd, char *url, wchar_t *file, wchar_t *dlgtitle); */\n\n\n#define IPC_MBOPEN 241\n/* (requires Winamp 2.05+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_MBOPEN);\n** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)url,IPC_MBOPEN);\n** IPC_MBOPEN will open a new URL in the minibrowser. if url is NULL, it will open the Minibrowser window.\n*/\n\n\n#define IPC_CHANGECURRENTFILE 245\n/* (requires Winamp 2.05+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)file,IPC_CHANGECURRENTFILE);\n** IPC_CHANGECURRENTFILE will set the current playlist item.\n*/\n\n\n#define IPC_CHANGECURRENTFILEW 1245\n/* (requires Winamp 5.3+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)file,IPC_CHANGECURRENTFILEW);\n** IPC_CHANGECURRENTFILEW will set the current playlist item.\n*/\n\n\n#define IPC_GETMBURL 246\n/* (requires Winamp 2.2+)\n** char buffer[4096]; // Urls can be VERY long\n** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)buffer,IPC_GETMBURL);\n** IPC_GETMBURL will retrieve the current Minibrowser URL into buffer.\n** buffer must be at least 4096 bytes long.\n*/\n\n\n#define IPC_MBBLOCK 248\n/* (requires Winamp 2.4+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_MBBLOCK);\n**\n** IPC_MBBLOCK will block the Minibrowser from updates if value is set to 1\n*/\n\n\n#define IPC_MBOPENREAL 249\n/* (requires Winamp 2.4+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)url,IPC_MBOPENREAL);\n**\n** IPC_MBOPENREAL works the same as IPC_MBOPEN except that it will works even if \n** IPC_MBBLOCK has been set to 1\n*/\n\n\n#define IPC_ADJUST_OPTIONSMENUPOS 280\n/* (requires Winamp 2.9+)\n** int newpos=SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)adjust_offset,IPC_ADJUST_OPTIONSMENUPOS);\n** moves where winamp expects the Options menu in the main menu. Useful if you wish to insert a\n** menu item above the options/skins/vis menus.\n*/\n\n\n#define IPC_GET_HMENU 281\n/* (requires Winamp 2.9+)\n** HMENU hMenu=SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)0,IPC_GET_HMENU);\n** values for data:\n** 0 : main popup menu \n** 1 : main menubar file menu\n** 2 : main menubar options menu\n** 3 : main menubar windows menu\n** 4 : main menubar help menu\n** other values will return NULL.\n*/\n\n\n#define IPC_GET_EXTENDED_FILE_INFO 290 //pass a pointer to the following struct in wParam\n#define IPC_GET_EXTENDED_FILE_INFO_HOOKABLE 296\n/* (requires Winamp 2.9+)\n** to use, create an extendedFileInfoStruct, point the values filename and metadata to the\n** filename and metadata field you wish to query, and ret to a buffer, with retlen to the\n** length of that buffer, and then SendMessage(hwnd_winamp,WM_WA_IPC,&struct,IPC_GET_EXTENDED_FILE_INFO);\n** the results should be in the buffer pointed to by ret.\n** returns 1 if the decoder supports a getExtendedFileInfo method\n*/\ntypedef struct {\n  const char *filename;\n  const char *metadata;\n  char *ret;\n  size_t retlen;\n} extendedFileInfoStruct;\n\n\n#define IPC_GET_BASIC_FILE_INFO 291 //pass a pointer to the following struct in wParam\ntypedef struct {\n  const char *filename;\n\n  int quickCheck; // set to 0 to always get, 1 for quick, 2 for default (if 2, quickCheck will be set to 0 if quick wasnot used)\n\n  // filled in by winamp\n  int length;\n  char *title;\n  int titlelen;\n} basicFileInfoStruct;\n\n\n#define IPC_GET_BASIC_FILE_INFOW 1291 //pass a pointer to the following struct in wParam\ntypedef struct {\n  const wchar_t *filename;\n\n  int quickCheck; // set to 0 to always get, 1 for quick, 2 for default (if 2, quickCheck will be set to 0 if quick wasnot used)\n\n  // filled in by winamp\n  int length;\n  wchar_t *title;\n  int titlelen;\n} basicFileInfoStructW;\n\n\n#define IPC_GET_EXTLIST 292 //returns doublenull delimited. GlobalFree() it when done. if data is 0, returns raw extlist, if 1, returns something suitable for getopenfilename\n#define IPC_GET_EXTLISTW 1292 // wide char version of above\n\n\n#define IPC_INFOBOX 293\ntypedef struct {\n  HWND parent;\n  char *filename;\n} infoBoxParam;\n\n\n#define IPC_INFOBOXW 1293\ntypedef struct {\n  HWND parent;\n  const wchar_t *filename;\n} infoBoxParamW;\n\n\n#define IPC_SET_EXTENDED_FILE_INFO 294 //pass a pointer to the a extendedFileInfoStruct in wParam\n/* (requires Winamp 2.9+)\n** to use, create an extendedFileInfoStruct, point the values filename and metadata to the\n** filename and metadata field you wish to write in ret. (retlen is not used). and then \n** SendMessage(hwnd_winamp,WM_WA_IPC,&struct,IPC_SET_EXTENDED_FILE_INFO);\n** returns 1 if the metadata is supported\n** Call IPC_WRITE_EXTENDED_FILE_INFO once you're done setting all the metadata you want to update\n*/\n\n\n#define IPC_WRITE_EXTENDED_FILE_INFO 295 \n/* (requires Winamp 2.9+)\n** writes all the metadata set thru IPC_SET_EXTENDED_FILE_INFO to the file\n** returns 1 if the file has been successfully updated, 0 if error\n*/\n\n\n#define IPC_FORMAT_TITLE 297\ntypedef struct \n{\n  char *spec; // NULL=default winamp spec\n  void *p;\n\n  char *out;\n  int out_len;\n\n  char * (*TAGFUNC)(const char * tag, void * p); //return 0 if not found\n  void (*TAGFREEFUNC)(char * tag,void * p);\n} waFormatTitle;\n\n\n#define IPC_FORMAT_TITLE_EXTENDED 298 // similiar to IPC_FORMAT_TITLE, but falls back to Winamp's %tags% if your passed tag function doesn't handle it\ntypedef struct \n{\n  const wchar_t *filename;\n  int useExtendedInfo; // set to 1 if you want the Title Formatter to query the input plugins for any tags that your tag function fails on\n  const wchar_t *spec; // NULL=default winamp spec\n  void *p;\n\n  wchar_t *out;\n  int out_len;\n\n  wchar_t * (*TAGFUNC)(const wchar_t * tag, void * p); //return 0 if not found, -1 for empty tag\n  void (*TAGFREEFUNC)(wchar_t *tag, void *p);\n} waFormatTitleExtended;\n\n\n#define IPC_COPY_EXTENDED_FILE_INFO 299 \ntypedef struct\n{\n  const char *source;\n  const char *dest;\n} copyFileInfoStruct;\n\n\n#define IPC_COPY_EXTENDED_FILE_INFOW 1299 \ntypedef struct\n{\n  const wchar_t *source;\n  const wchar_t *dest;\n} copyFileInfoStructW;\n\n\ntypedef struct {\n  int (*inflateReset)(void *strm);\n  int (*inflateInit_)(void *strm,const char *version, int stream_size);\n  int (*inflate)(void *strm, int flush);\n  int (*inflateEnd)(void *strm);\n  unsigned long (*crc32)(unsigned long crc, const unsigned  char *buf, unsigned int len);\n} wa_inflate_struct;\n\n#define IPC_GETUNCOMPRESSINTERFACE 331\n/* returns a function pointer to uncompress().\n** int (*uncompress)(unsigned char *dest, unsigned long *destLen, const unsigned char *source, unsigned long sourceLen);\n** right out of zlib, useful for decompressing zlibbed data.\n** if you pass the parm of 0x10100000, it will return a wa_inflate_struct * to an inflate API.\n*/\n\n\ntypedef struct _prefsDlgRec {\n  HINSTANCE hInst;  // dll instance containing the dialog resource\n  int dlgID;        // resource identifier of the dialog\n  void *proc;       // window proceedure for handling the dialog defined as\n                    // LRESULT CALLBACK PrefsPage(HWND,UINT,WPARAM,LPARAM)\n\n  char *name;       // name shown for the prefs page in the treelist\n  intptr_t where;   // section in the treelist the prefs page is to be added to\n                    // 0 for General Preferences\n                    // 1 for Plugins\n                    // 2 for Skins\n                    // 3 for Bookmarks (no longer in the 5.0+ prefs)\n                    // 4 for Prefs     (the old 'Setup' section - no longer in 5.0+)\n\n  intptr_t _id;\n  struct _prefsDlgRec *next; // no longer implemented as a linked list, now used by Winamp for other means\n} prefsDlgRec;\n\ntypedef struct _prefsDlgRecW {\n  HINSTANCE hInst;  // dll instance containing the dialog resource\n  int dlgID;        // resource identifier of the dialog\n  void *proc;       // window proceedure for handling the dialog defined as\n                    // LRESULT CALLBACK PrefsPage(HWND,UINT,WPARAM,LPARAM)\n\n  wchar_t *name;    // name shown for the prefs page in the treelist\n  intptr_t where;   // section in the treelist the prefs page is to be added to\n                    // 0 for General Preferences\n                    // 1 for Plugins\n                    // 2 for Skins\n                    // 3 for Bookmarks (no longer in the 5.0+ prefs)\n                    // 4 for Prefs     (the old 'Setup' section - no longer in 5.0+)\n\n  intptr_t _id;\n  struct _prefsDlgRec *next; // no longer implemented as a linked list, now used by Winamp for other means\n} prefsDlgRecW;\n\n#define IPC_ADD_PREFS_DLG 332\n#define IPC_ADD_PREFS_DLGW 1332 \n#define IPC_REMOVE_PREFS_DLG 333\n/* (requires Winamp 2.9+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)&prefsRec,IPC_ADD_PREFS_DLG);\n** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)&prefsRec,IPC_REMOVE_PREFS_DLG);\n**\n** IPC_ADD_PREFS_DLG:\n** To use this you need to allocate a prefsDlgRec structure (either on the heap or with\n** some global data but NOT on the stack) and then initialise the members of the structure\n** (see the definition of the prefsDlgRec structure above).\n**\n**   hInst  -  dll instance of where the dialog resource is located.\n**   dlgID  -  id of the dialog resource.\n**   proc   -  dialog window procedure for the prefs dialog.\n**   name   -  name of the prefs page as shown in the preferences list.\n**   where  -  see above for the valid locations the page can be added.\n**\n** Then you do SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)&prefsRec,IPC_ADD_PREFS_DLG);\n**\n** example:\n**\n** prefsDlgRec* prefsRec = 0;\n**   prefsRec = GlobalAlloc(GPTR,sizeof(prefsDlgRec));\n**   prefsRec->hInst = hInst;\n**   prefsRec->dlgID = IDD_PREFDIALOG;\n**   prefsRec->name = \"Pref Page\";\n**   prefsRec->where = 0;\n**   prefsRec->proc = PrefsPage;\n**   SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)&prefsRec,IPC_ADD_PREFS_DLG);\n**\n**\n** IPC_REMOVE_PREFS_DLG:\n** To use you pass the address of the same prefsRec you used when adding the prefs page \n** though you shouldn't really ever have to do this but it's good to clean up after you\n** when you're plugin is being unloaded.\n**\n** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)&prefsRec,IPC_REMOVE_PREFS_DLG);\n**\n** IPC_ADD_PREFS_DLGW\n** requires Winamp 5.53+\n*/\n\n\n#define IPC_OPENPREFSTOPAGE 380\n/* SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)&prefsRec,IPC_OPENPREFSTOPAGE);\n**\n** There are two ways of opening a preferences page.\n**\n** The first is to pass an id of a builtin preferences page (see below for ids) or a\n** &prefsDlgRec of the preferences page to open and this is normally done if you are\n** opening a prefs page you added yourself.\n**\n** If the page id does not or the &prefsRec is not valid then the prefs dialog will be\n** opened to the first page available (usually the Winamp Pro page).\n**\n** (requires Winamp 5.04+)\n** Passing -1 for param will open the preferences dialog to the last page viewed.\n**\n** Note: v5.0 to 5.03 had a bug in this api\n**       \n** On the first call then the correct prefs page would be opened to but on the next call\n** the prefs dialog would be brought to the front but the page would not be changed to the\n** specified.\n** In 5.04+ it will change to the prefs page specified if the prefs dialog is already open.\n*/\n\n/* Builtin Preference page ids (valid for 5.0+)\n** (stored in the lParam member of the TVITEM structure from the tree item)\n**\n** These can be useful if you want to detect a specific prefs page and add things to it\n** yourself or something like that ;)\n**\n** Winamp Pro           20\n** General Preferences  0\n** File Types           1\n** Playlist             23\n** Titles               21\n** Playback             42 (added in 5.25)\n** Station Info         41 (added in 5.11 & removed in 5.5)\n** Video                24\n** Localization         25 (added in 5.5)\n** Skins                40\n** Classic Skins        22\n** Plugins              30\n** Input                31\n** Output               32\n** Visualisation        33\n** DSP/Effect           34\n** General Purpose      35\n**\n** Note:\n** Custom page ids begin from 60\n** The value of the normal custom pages (Global Hotkeys, Jump To File, etc) is not\n** guaranteed since it depends on the order in which the plugins are loaded which can\n** change on different systems.\n**\n** Global Hotkeys, Jump To File, Media Library (under General Preferences and child pages),\n** Media Library (under Plugins), Portables, CD Ripping and Modern Skins are custom pages\n** created by the plugins shipped with Winamp.\n*/\n\n\n#define IPC_GETINIFILE 334\n/* (requires Winamp 2.9+)\n** char *ini=(char*)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETINIFILE);\n** This returns a pointer to the full file path of winamp.ini.\n**\n** char ini_path[MAX_PATH] = {0};\n**\n** void GetIniFilePath(HWND hwnd){\n**   if(SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVERSION) >= 0x2900){\n**     // this gets the string of the full ini file path\n**     lstrcpyn(ini_path,(char*)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETINIFILE),sizeof(ini_path));\n**   }\n**   else{\n**   char* p = ini_path;\n**     p += GetModuleFileName(0,ini_path,sizeof(ini_path)) - 1;\n**     while(p && *p != '.'){p--;}\n**     lstrcpyn(p+1,\"ini\",sizeof(ini_path));\n**   }\n** }\n*/\n\n\n#define IPC_GETINIDIRECTORY 335\n/* (requires Winamp 2.9+)\n** char *dir=(char*)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETINIDIRECTORY);\n** This returns a pointer to the directory where winamp.ini can be found and is\n** useful if you want store config files but you don't want to use winamp.ini.\n*/\n\n\n#define IPC_GETPLUGINDIRECTORY 336\n/* (requires Winamp 5.11+)\n** char *plugdir=(char*)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETPLUGINDIRECTORY);\n** This returns a pointer to the directory where Winamp has its plugins stored and is\n** useful if you want store config files in plugins.ini in the plugins folder or for\n** accessing any local files in the plugins folder.\n*/\n\n\n#define IPC_GETM3UDIRECTORY 337\n/* (requires Winamp 5.11+)\n** char *m3udir=(char*)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETM3UDIRECTORY);\n** This returns a pointer to the directory where winamp.m3u (and winamp.m3u8 if supported) is stored in.\n*/\n\n\n#define IPC_GETM3UDIRECTORYW 338\n/* (requires Winamp 5.3+)\n** wchar_t *m3udirW=(wchar_t*)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETM3UDIRECTORYW);\n** This returns a pointer to the directory where winamp.m3u (and winamp.m3u8 if supported) is stored in.\n*/\n\n\n#define IPC_SPAWNBUTTONPOPUP 361 // param =\n// 0 = eject\n// 1 = previous\n// 2 = next\n// 3 = pause\n// 4 = play\n// 5 = stop\n\n\n#define IPC_OPENURLBOX 360\n/* (requires Winamp 5.0+)\n** HGLOBAL hglobal = (HGLOBAL)SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)(HWND)parent,IPC_OPENURLBOX);\n** You pass a hwnd for the dialog to be parented to (which modern skin support uses).\n** This will return a HGLOBAL that needs to be freed with GlobalFree() if this worked.\n*/\n\n\n#define IPC_OPENFILEBOX 362\n/* (requires Winamp 5.0+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)(HWND)parent,IPC_OPENFILEBOX);\n** You pass a hwnd for the dialog to be parented to (which modern skin support uses).\n*/\n\n\n#define IPC_OPENDIRBOX 363\n/* (requires Winamp 5.0+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)(HWND)parent,IPC_OPENDIRBOX);\n** You pass a hwnd for the dialog to be parented to (which modern skin support uses).\n*/\n\n\n#define IPC_SETDIALOGBOXPARENT 364\n/* (requires Winamp 5.0+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)(HWND)parent,IPC_SETDIALOGBOXPARENT);\n** Pass 'parent' as the window which will be used as the parent for a number of the built\n** in Winamp dialogs and is useful when you are taking over the whole of the UI so that\n** the dialogs will not appear at the bottom right of the screen since the main winamp\n** window is located at 3000x3000 by gen_ff when this is used.  Call this again with\n** parent = null to reset the parent back to the orginal Winamp window.\n*/\n\n#define IPC_GETDIALOGBOXPARENT 365\n/* (requires Winamp 5.51+)\n** HWND hwndParent = SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)0, IPC_GETDIALOGBOXPARENT);\n** hwndParent can/must be passed to all modal dialogs (including MessageBox) thats uses winamp as a parent\n*/\n\n#define IPC_UPDATEDIALOGBOXPARENT 366\n/* (requires Winamp 5.53+)\n** if you previous called IPC_SETDIALOGBOXPARENT, call this every time your window resizes\n*/ \n\n#define IPC_DRO_MIN 401 // reserved for DrO\n#define IPC_SET_JTF_COMPARATOR 409\n/* pass me an int (__cdecl *)(const char *, const char *) in wParam */\n#define IPC_SET_JTF_COMPARATOR_W 410\n/* pass me an int (__cdecl *)(const wchar_t *, const wchar_t *) in wParam ... maybe someday :) */\n#define IPC_SET_JTF_DRAWTEXT 416\n\n#define IPC_DRO_MAX 499\n\n\n// pass 0 for a copy of the skin HBITMAP\n// pass 1 for name of font to use for playlist editor likeness\n// pass 2 for font charset\n// pass 3 for font size\n#define IPC_GET_GENSKINBITMAP 503\n\n\ntypedef struct\n{\n  HWND me; //hwnd of the window\n\n  #define EMBED_FLAGS_NORESIZE 0x1\n  // set this bit to keep window from being resizable\n\n  #define EMBED_FLAGS_NOTRANSPARENCY 0x2\n  // set this bit to make gen_ff turn transparency off for this window\n\n  #define EMBED_FLAGS_NOWINDOWMENU 0x4\n  // set this bit to prevent gen_ff from automatically adding your window to the right-click menu\n\n  #define EMBED_FLAGS_GUID 0x8\n  // (5.31+) call SET_EMBED_GUID(yourEmbedWindowStateStruct, GUID) to define a GUID for this window \n\n  #define SET_EMBED_GUID(windowState, windowGUID) { windowState->flags |= EMBED_FLAGS_GUID; *((GUID *)&windowState->extra_data[4])=windowGUID; }\n  #define GET_EMBED_GUID(windowState) (*((GUID *)&windowState->extra_data[4]))\n\n  int flags;  // see above\n\n  RECT r;\n  void *user_ptr;       // for application use\n  int extra_data[64];   // for internal winamp use\n} embedWindowState;\n\n#define IPC_GET_EMBEDIF 505\n/* (requires Winamp 2.9+)\n** HWND myframe = (HWND)SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)&wa_wnd,IPC_GET_EMBEDIF);\n**\n** or\n**\n** HWND myframe = 0;\n** HWND (*embed)(embedWindowState *params)=0;\n**   *(void**)&embed = (void*)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_EMBEDIF);\n**   myframe = embed(&wa_wnd);\n**\n** You pass an embedWindowState* and it will return a hwnd for the frame window or if you\n** pass wParam as null then it will return a HWND embedWindow(embedWindowState *);\n*/\n\n#define IPC_SKINWINDOW\t534\n\ntypedef struct __SKINWINDOWPARAM \n{\n\tHWND hwndToSkin;\n\tGUID windowGuid;\n} SKINWINDOWPARAM;\n\n\n\n#define IPC_EMBED_ENUM 532\ntypedef struct embedEnumStruct\n{\n  int (*enumProc)(embedWindowState *ws, struct embedEnumStruct *param); // return 1 to abort\n  int user_data; // or more :)\n} embedEnumStruct;\n  // pass \n\n\n#define IPC_EMBED_ISVALID 533\n/* (requires Winamp 2.9+)\n** int valid = SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)embedhwnd,IPC_EMBED_ISVALID);\n** Pass a hwnd in the wParam to this to check if the hwnd is a valid embed window or not.\n*/\n\n\n#define IPC_CONVERTFILE 506\n/* (requires Winamp 2.92+)\n** Converts a given file to a different format (PCM, MP3, etc...)\n** To use, pass a pointer to a waFileConvertStruct struct\n** This struct can be either on the heap or some global\n** data, but NOT on the stack. At least, until the conversion is done.\n**\n** eg: SendMessage(hwnd_winamp,WM_WA_IPC,&myConvertStruct,IPC_CONVERTFILE);\n**\n** Return value:\n** 0: Can't start the conversion. Look at myConvertStruct->error for details.\n** 1: Conversion started. Status messages will be sent to the specified callbackhwnd.\n**    Be sure to call IPC_CONVERTFILE_END when your callback window receives the\n**    IPC_CB_CONVERT_DONE message.\n*/\ntypedef struct \n{\n  char *sourcefile;  // \"c:\\\\source.mp3\"\n  char *destfile;    // \"c:\\\\dest.pcm\"\n  intptr_t destformat[8]; // like 'PCM ',srate,nch,bps.\n  //hack alert! you can set destformat[6]=mmioFOURCC('I','N','I',' '); and destformat[7]=(int)my_ini_file; (where my_ini_file is a char*)\n  HWND callbackhwnd; // window that will receive the IPC_CB_CONVERT notification messages\n  \n  //filled in by winamp.exe\n  char *error;        //if IPC_CONVERTFILE returns 0, the reason will be here\n\n  int bytes_done;     //you can look at both of these values for speed statistics\n  int bytes_total;\n  int bytes_out;\n\n  int killswitch;     // don't set it manually, use IPC_CONVERTFILE_END\n  intptr_t extra_data[64]; // for internal winamp use\n} convertFileStruct;\n\n\n#define IPC_CONVERTFILEW 515\n// (requires Winamp 5.36+)\ntypedef struct \n{\n  wchar_t *sourcefile;  // \"c:\\\\source.mp3\"\n  wchar_t *destfile;    // \"c:\\\\dest.pcm\"\n  intptr_t destformat[8]; // like 'PCM ',srate,nch,bps.\n  //hack alert! you can set destformat[6]=mmioFOURCC('I','N','I',' '); and destformat[7]=(int)my_ini_file; (where my_ini_file is a char*)\n  HWND callbackhwnd; // window that will receive the IPC_CB_CONVERT notification messages\n  \n  //filled in by winamp.exe\n  wchar_t *error;        //if IPC_CONVERTFILE returns 0, the reason will be here\n\n  int bytes_done;     //you can look at both of these values for speed statistics\n  int bytes_total;\n  int bytes_out;\n\n  int killswitch;     // don't set it manually, use IPC_CONVERTFILE_END\n  intptr_t extra_data[64]; // for internal winamp use\n} convertFileStructW;\n\n\n#define IPC_CONVERTFILE_END 507\n/* (requires Winamp 2.92+)\n** Stop/ends a convert process started from IPC_CONVERTFILE\n** You need to call this when you receive the IPC_CB_CONVERTDONE message or when you\n** want to abort a conversion process\n**\n** eg: SendMessage(hwnd_winamp,WM_WA_IPC,&myConvertStruct,IPC_CONVERTFILE_END);\n**\n** No return value\n*/\n\n\n#define IPC_CONVERTFILEW_END 516\n// (requires Winamp 5.36+)\n\ntypedef struct {\n  HWND hwndParent;\n  int format;\n\n  //filled in by winamp.exe\n  HWND hwndConfig;\n  int extra_data[8];\n  //hack alert! you can set extra_data[6]=mmioFOURCC('I','N','I',' '); and extra_data[7]=(int)my_ini_file; (where my_ini_file is a char*)\n} convertConfigStruct;\n\n\n#define IPC_CONVERT_CONFIG 508\n#define IPC_CONVERT_CONFIG_END 509\n\ntypedef struct\n{\n  void (*enumProc)(intptr_t user_data, const char *desc, int fourcc);\n  intptr_t user_data;\n} converterEnumFmtStruct;\n#define IPC_CONVERT_CONFIG_ENUMFMTS 510\n/* (requires Winamp 2.92+)\n*/\n\ntypedef struct\n{\n  char cdletter;\n  char *playlist_file;\n  HWND callback_hwnd;\n\n  //filled in by winamp.exe\n  char *error;\n} burnCDStruct;\n#define IPC_BURN_CD 511\n/* (requires Winamp 5.0+)\n*/\n\ntypedef struct\n{\n  convertFileStruct *cfs;\n  int priority;\n} convertSetPriority;\n\n\n#define IPC_CONVERT_SET_PRIORITY 512\n\ntypedef struct\n{\n  convertFileStructW *cfs;\n  int priority;\n} convertSetPriorityW;\n\n\n#define IPC_CONVERT_SET_PRIORITYW 517\n// (requires Winamp 5.36+)\n\ntypedef struct\n{\n  unsigned int format; //fourcc value\n  char *item; // config item, eg \"bitrate\"\n  char *data; // buffer to recieve, or buffer that contains the data\n  int len; // length of the data buffer (only used when getting a config item)\n  char *configfile; // config file to read from\n} convertConfigItem;\n\n\n#define IPC_CONVERT_CONFIG_SET_ITEM 513 // returns TRUE if successful\n#define IPC_CONVERT_CONFIG_GET_ITEM 514 // returns TRUE if successful\n\n\ntypedef struct\n{\n  const char *filename;\n  char *title; // 2048 bytes\n  int length;\n  int force_useformatting; // can set this to 1 if you want to force a url to use title formatting shit\n} waHookTitleStruct;\n\n#define IPC_HOOK_TITLES 850\n/* (requires Winamp 5.0+)\n** If you hook this message and modify the information then make sure to return TRUE.\n** If you don't hook the message then make sure you pass it on through the subclass chain.\n**\n** LRESULT CALLBACK WinampWndProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)\n** {\n**   LRESULT ret = CallWindowProc((WNDPROC)WinampProc,hwnd,umsg,wParam,lParam);\n**\n**   if(message==WM_WA_IPC && lParam==IPC_HOOK_TITLES)\n**   {\n**     waHookTitleStruct *ht = (waHookTitleStruct *) wParam;\n**     // Doing ATF stuff with ht->title, whatever...\n**     return TRUE;\n**   }\n**   return ret;\n** }\n*/\n\ntypedef struct\n{\n  const wchar_t *filename;\n  wchar_t *title; // 2048 characters\n  int length;\n  int force_useformatting; // can set this to 1 if you want to force a url to use title formatting shit\n} waHookTitleStructW;\n#define IPC_HOOK_TITLESW 851\n/* (requires Winamp 5.3+)\n** See information on IPC_HOOK_TITLES for how to process this.\n*/\n\n\n#define IPC_GETSADATAFUNC 800 \n// 0: returns a char *export_sa_get() that returns 150 bytes of data\n// 1: returns a export_sa_setreq(int want);\n\n\n#define IPC_GETVUDATAFUNC 801 \n// 0: returns a int export_vu_get(int channel) that returns 0-255 (or -1 for bad channel)\n\n\n#define IPC_ISMAINWNDVISIBLE 900\n/* (requires Winamp 5.0+)\n** int visible=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISMAINWNDVISIBLE);\n** You send this to Winamp to query if the main window is visible or not such as by\n** unchecking the option in the main right-click menu. If the main window is visible then\n** this will return 1 otherwise it returns 0.\n*/\n\n\ntypedef struct\n{\n  int numElems;\n  int *elems;\n  HBITMAP bm; // set if you want to override\n} waSetPlColorsStruct;\n\n#define IPC_SETPLEDITCOLORS 920\n/* (requires Winamp 5.0+)\n** This is sent by gen_ff when a modern skin is being loaded to set the colour scheme for\n** the playlist editor. When sent numElems is usually 6 and matches with the 6 possible\n** colours which are provided be pledit.txt from the classic skins. The elems array is\n** defined as follows:\n**\n** elems = 0  =>  normal text\n** elems = 1  =>  current text\n** elems = 2  =>  normal background\n** elems = 3  =>  selected background\n** elems = 4  =>  minibroswer foreground\n** elems = 5  =>  minibroswer background\n**\n** if(uMsg == WM_WA_IPC && lParam == IPC_SETPLEDITCOLORS)\n** {\n**   waSetPlColorsStruct* colStr = (waSetPlColorsStruct*)wp;\n**   if(colStr)\n**   {\n**      // set or inspect the colours being used (basically for gen_ff's benefit)\n**   }\n** }\n*/\n\n\ntypedef struct\n{\n  HWND wnd;\n  int xpos; // in screen coordinates\n  int ypos;\n} waSpawnMenuParms;\n\n// waSpawnMenuParms2 is used by the menubar submenus\ntypedef struct\n{\n  HWND wnd;\n  int xpos; // in screen coordinates\n  int ypos;\n  int width;\n  int height;\n} waSpawnMenuParms2;\n\n// the following IPC use waSpawnMenuParms as parameter\n#define IPC_SPAWNEQPRESETMENU 933\n#define IPC_SPAWNFILEMENU 934 //menubar\n#define IPC_SPAWNOPTIONSMENU 935 //menubar\n#define IPC_SPAWNWINDOWSMENU 936 //menubar\n#define IPC_SPAWNHELPMENU 937 //menubar\n#define IPC_SPAWNPLAYMENU 938 //menubar\n#define IPC_SPAWNPEFILEMENU 939 //menubar\n#define IPC_SPAWNPEPLAYLISTMENU 940 //menubar\n#define IPC_SPAWNPESORTMENU 941 //menubar\n#define IPC_SPAWNPEHELPMENU 942 //menubar\n#define IPC_SPAWNMLFILEMENU 943 //menubar\n#define IPC_SPAWNMLVIEWMENU 944 //menubar\n#define IPC_SPAWNMLHELPMENU 945 //menubar\n#define IPC_SPAWNPELISTOFPLAYLISTS 946\n\n\n#define WM_WA_SYSTRAY WM_USER+1\n/* This is sent by the system tray when an event happens (you might want to simulate it).\n**\n** if(uMsg == WM_WA_SYSTRAY)\n** {\n**   switch(lParam)\n**   {\n**     // process the messages sent from the tray\n**   }\n** }\n*/\n\n\n#define WM_WA_MPEG_EOF WM_USER+2\n/* Input plugins send this when they are done playing back the current file to inform\n** Winamp or anyother installed plugins that the current\n**\n** if(uMsg == WM_WA_MPEG_EOF)\n** {\n**   // do what is needed here\n** }\n*/\n\n\n//// video stuff\n\n#define IPC_IS_PLAYING_VIDEO 501 // returns >1 if playing, 0 if not, 1 if old version (so who knows):)\n#define IPC_GET_IVIDEOOUTPUT 500 // see below for IVideoOutput interface\n#define VIDEO_MAKETYPE(A,B,C,D) ((A) | ((B)<<8) | ((C)<<16) | ((D)<<24))\n#define VIDUSER_SET_INFOSTRING 0x1000\n#define VIDUSER_GET_VIDEOHWND  0x1001\n#define VIDUSER_SET_VFLIP      0x1002\n#define VIDUSER_SET_TRACKSELINTERFACE 0x1003 // give your ITrackSelector interface as param2\n#define VIDUSER_OPENVIDEORENDERER 0x1004\n#define VIDUSER_CLOSEVIDEORENDERER 0x1005\n#define VIDUSER_GETPOPUPMENU 0x1006\n#define VIDUSER_SET_INFOSTRINGW 0x1007\n\ntypedef struct\n{\n  int w;\n  int h;\n  int vflip;\n  double aspectratio;\n  unsigned int fmt;\n} VideoOpenStruct;\n\n#ifndef NO_IVIDEO_DECLARE\n#ifdef __cplusplus\n\nclass VideoOutput;\nclass SubsItem;\n\n#ifndef _NSV_DEC_IF_H_\nstruct YV12_PLANE {\n  unsigned char* baseAddr;\n  long rowBytes;\n} ;\n\nstruct YV12_PLANES {\n  YV12_PLANE y;\n  YV12_PLANE u;\n  YV12_PLANE v;\n};\n#endif\n\nclass IVideoOutput\n{\n  public:\n    virtual ~IVideoOutput() { }\n    virtual int open(int w, int h, int vflip, double aspectratio, unsigned int fmt)=0;\n    virtual void setcallback(LRESULT (*msgcallback)(void *token, HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam), void *token) { (void)token; (void)msgcallback; /* to eliminate warning C4100 */ }\n    virtual void close()=0;\n    virtual void draw(void *frame)=0;\n    virtual void drawSubtitle(SubsItem *item) {UNREFERENCED_PARAMETER(item);  }\n    virtual void showStatusMsg(const char *text) {UNREFERENCED_PARAMETER(text);  }\n    virtual int get_latency() { return 0; }\n    virtual void notifyBufferState(int bufferstate) { UNREFERENCED_PARAMETER(bufferstate); } /* 0-255*/\n\tvirtual INT_PTR extended(INT_PTR param1, INT_PTR param2, INT_PTR param3) { UNREFERENCED_PARAMETER(param1); UNREFERENCED_PARAMETER(param2); UNREFERENCED_PARAMETER(param3); return 0; } // Dispatchable, eat this!\n};\n\nclass ITrackSelector \n{\n  public:\n    virtual int getNumAudioTracks()=0;\n    virtual void enumAudioTrackName(int n, const char *buf, int size)=0;\n    virtual int getCurAudioTrack()=0;\n    virtual int getNumVideoTracks()=0;\n    virtual void enumVideoTrackName(int n, const char *buf, int size)=0;\n    virtual int getCurVideoTrack()=0;\n\n    virtual void setAudioTrack(int n)=0;\n    virtual void setVideoTrack(int n)=0;\n};\n\n#endif //cplusplus\n#endif//NO_IVIDEO_DECLARE\n\n// these messages are callbacks that you can grab by subclassing the winamp window\n\n// wParam = \n#define IPC_CB_WND_EQ 0 // use one of these for the param\n#define IPC_CB_WND_PE 1\n#define IPC_CB_WND_MB 2\n#define IPC_CB_WND_VIDEO 3\n#define IPC_CB_WND_MAIN 4\n\n#define IPC_CB_ONSHOWWND 600 \n#define IPC_CB_ONHIDEWND 601 \n\n#define IPC_CB_GETTOOLTIP 602\n\n#define IPC_CB_MISC 603\n    #define IPC_CB_MISC_TITLE 0  // start of playing/stop/pause\n    #define IPC_CB_MISC_VOLUME 1 // volume/pan\n    #define IPC_CB_MISC_STATUS 2 // start playing/stop/pause/ffwd/rwd\n    #define IPC_CB_MISC_EQ 3\n    #define IPC_CB_MISC_INFO 4\n    #define IPC_CB_MISC_VIDEOINFO 5\n    #define IPC_CB_MISC_TITLE_RATING 6 // (5.5+ for when the rating is changed via the songticker menu on current file)\n\n/* Example of using IPC_CB_MISC_STATUS to detect the start of track playback with 5.x\n**\n** if(lParam == IPC_CB_MISC && wParam == IPC_CB_MISC_STATUS)\n** {\n**   if(SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISPLAYING) == 1 &&\n**      !SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETOUTPUTTIME))\n**   {\n**     char* file = (char*)SendMessage(hwnd_winamp,WM_WA_IPC,\n**                  SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTPOS),IPC_GETPLAYLISTFILE);\n**     // only output if a valid file was found\n**     if(file)\n**     {\n**       MessageBox(hwnd_winamp,file,\"starting\",0);\n**       // or do something else that you need to do\n**     }\n**   }\n** }\n*/\n\n\n#define IPC_CB_CONVERT_STATUS 604 // param value goes from 0 to 100 (percent)\n#define IPC_CB_CONVERT_DONE   605\n\n\n#define IPC_ADJUST_FFWINDOWSMENUPOS 606\n/* (requires Winamp 2.9+)\n** int newpos=SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)adjust_offset,IPC_ADJUST_FFWINDOWSMENUPOS);\n** This will move where Winamp expects the freeform windows in the menubar windows main\n** menu. This is useful if you wish to insert a menu item above extra freeform windows.\n*/\n\n\n#define IPC_ISDOUBLESIZE 608\n/* (requires Winamp 5.0+)\n** int dsize=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISDOUBLESIZE);\n** You send this to Winamp to query if the double size mode is enabled or not.\n** If it is on then this will return 1 otherwise it will return 0.\n*/\n\n\n#define IPC_ADJUST_FFOPTIONSMENUPOS 609\n/* (requires Winamp 2.9+)\n** int newpos=SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)adjust_offset,IPC_ADJUST_FFOPTIONSMENUPOS);\n** moves where winamp expects the freeform preferences item in the menubar windows main\n** menu. This is useful if you wish to insert a menu item above the preferences item.\n**\n** Note: This setting was ignored by gen_ff until it was fixed in 5.1\n**       gen_ff would assume thatthe menu position was 11 in all cases and so when you\n**       had two plugins attempting to add entries into the main right click menu it\n**       would cause the 'colour themes' submenu to either be incorrectly duplicated or\n**       to just disappear.instead.\n*/\n\n\n#define IPC_GETTIMEDISPLAYMODE 610\n/* (requires Winamp 5.0+)\n** int mode=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETTIMEDISPLAYMODE);\n** This will return the status of the time display i.e. shows time elapsed or remaining.\n** This returns 0 if Winamp is displaying time elapsed or 1 for the time remaining.\n*/\n\n\n#define IPC_SETVISWND 611\n/* (requires Winamp 5.0+)\n** int viswnd=(HWND)SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)(HWND)viswnd,IPC_SETVISWND);\n** This allows you to set a window to receive the following message commands (which are\n** used as part of the modern skin integration).\n** When you have finished or your visualisation is closed then send wParam as zero to\n** ensure that things are correctly tidied up.\n*/\n\n/* The following messages are received as the LOWORD(wParam) of the WM_COMMAND message.\n** See %SDK%\\winamp\\wa5vis.txt for more info about visualisation integration in Winamp.\n*/\n#define ID_VIS_NEXT                     40382\n#define ID_VIS_PREV                     40383\n#define ID_VIS_RANDOM                   40384\n#define ID_VIS_FS                       40389\n#define ID_VIS_CFG                      40390\n#define ID_VIS_MENU                     40391\n\n\n#define IPC_GETVISWND 612\n/* (requires Winamp 5.0+)\n** int viswnd=(HWND)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVISWND);\n** This returns a HWND to the visualisation command handler window if set by IPC_SETVISWND.\n*/\n\n\n#define IPC_ISVISRUNNING 613\n/* (requires Winamp 5.0+)\n** int visrunning=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISVISRUNNING);\n** This will return 1 if a visualisation is currently running and 0 if one is not running.\n*/\n\n\n#define IPC_CB_VISRANDOM 628 // param is status of random\n\n\n#define IPC_SETIDEALVIDEOSIZE 614\n/* (requires Winamp 5.0+)\n** This is sent by Winamp back to itself so it can be trapped and adjusted as needed with\n** the desired width in HIWORD(wParam) and the desired height in LOWORD(wParam).\n**\n** if(uMsg == WM_WA_IPC){\n**   if(lParam == IPC_SETIDEALVIDEOSIZE){\n**      wParam = MAKEWPARAM(height,width);\n**   }\n** }\n*/\n\n\n#define IPC_GETSTOPONVIDEOCLOSE 615\n/* (requires Winamp 5.0+)\n** int sovc=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETSTOPONVIDEOCLOSE);\n** This will return 1 if 'stop on video close' is enabled and 0 if it is disabled.\n*/\n\n\n#define IPC_SETSTOPONVIDEOCLOSE 616\n/* (requires Winamp 5.0+)\n** int sovc=SendMessage(hwnd_winamp,WM_WA_IPC,enabled,IPC_SETSTOPONVIDEOCLOSE);\n** Set enabled to 1 to enable and 0 to disable the 'stop on video close' option.\n*/\n\n\ntypedef struct {\n  HWND hwnd;\n  int uMsg;\n  WPARAM wParam;\n  LPARAM lParam;\n} transAccelStruct;\n\n#define IPC_TRANSLATEACCELERATOR 617\n/* (requires Winamp 5.0+)\n** (deprecated as of 5.53x+)\n*/\n\ntypedef struct {\n  int cmd;\n  int x;\n  int y;\n  int align;\n} windowCommand; // send this as param to an IPC_PLCMD, IPC_MBCMD, IPC_VIDCMD\n\n\n#define IPC_CB_ONTOGGLEAOT 618 \n\n\n#define IPC_GETPREFSWND 619\n/* (requires Winamp 5.0+)\n** HWND prefs = (HWND)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETPREFSWND);\n** This will return a handle to the preferences dialog if it is open otherwise it will\n** return zero. A simple check with the OS api IsWindow(..) is a good test if it's valid.\n**\n** e.g.  this will open (or close if already open) the preferences dialog and show if we\n**       managed to get a valid \n** SendMessage(hwnd_winamp,WM_COMMAND,MAKEWPARAM(WINAMP_OPTIONS_PREFS,0),0);\n** MessageBox(hwnd_winamp,(IsWindow((HWND)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETPREFSWND))?\"Valid\":\"Not Open\"),0,MB_OK);\n*/\n\n\n#define IPC_SET_PE_WIDTHHEIGHT 620\n/* (requires Winamp 5.0+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)&point,IPC_SET_PE_WIDTHHEIGHT);\n** You pass a pointer to a POINT structure which holds the width and height and Winamp\n** will set the playlist editor to that size (this is used by gen_ff on skin changes).\n** There does not appear to be any bounds limiting with this so it is possible to create\n** a zero size playlist editor window (which is a pretty silly thing to do).\n*/\n\n\n#define IPC_GETLANGUAGEPACKINSTANCE 621\n/* (requires Winamp 5.0+)\n** HINSTANCE hInst = (HINSTANCE)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLANGUAGEPACKINSTANCE);\n** This will return the HINSTANCE to the currently used language pack file for winamp.exe\n**\n** (5.5+)\n** If you pass 1 in wParam then you will have zero returned if a language pack is in use.\n** if(!SendMessage(hwnd_winamp,WM_WA_IPC,1,IPC_GETLANGUAGEPACKINSTANCE)){\n**   // winamp is currently using a language pack\n** }\n**\n** If you pass 2 in wParam then you will get the path to the language pack folder.\n** wchar_t* lngpackfolder = (wchar_t*)SendMessage(hwnd_winamp,WM_WA_IPC,2,IPC_GETLANGUAGEPACKINSTANCE);\n**\n** If you pass 3 in wParam then you will get the path to the currently extracted language pack.\n** wchar_t* lngpack = (wchar_t*)SendMessage(hwnd_winamp,WM_WA_IPC,3,IPC_GETLANGUAGEPACKINSTANCE);\n**\n** If you pass 4 in wParam then you will get the name of the currently used language pack.\n** wchar_t* lngname = (char*)SendMessage(hwnd_winamp,WM_WA_IPC,4,IPC_GETLANGUAGEPACKINSTANCE);\n*/\n#define LANG_IDENT_STR 0\n#define LANG_LANG_CODE 1\n#define LANG_COUNTRY_CODE 2\n/*\n** (5.51+)\n** If you pass 5 in LOWORD(wParam) then you will get the ident string/code string\n** (based on the param passed in the HIWORD(wParam) of the currently used language pack.\n** The string returned with LANG_IDENT_STR is used to represent the language that the\n** language pack is intended for following ISO naming conventions for consistancy.\n**\n** wchar_t* ident_str = (wchar_t*)SendMessage(hwnd_winamp,WM_WA_IPC,MAKEWPARAM(5,LANG_XXX),IPC_GETLANGUAGEPACKINSTANCE);\n**\n** e.g.\n** For the default language it will return the following for the different LANG_XXX codes\n**    LANG_IDENT_STR ->     \"en-US\" (max buffer size of this is 9 wchar_t)\n**    LANG_LANG_CODE ->     \"en\"    (language code)\n**    LANG_COUNTRY_CODE ->  \"US\"    (country code)\n**\n** On pre 5.51 installs you can get LANG_IDENT_STR using the following method\n** (you'll have to custom process the string returned if you want the langugage or country but that's easy ;) )\n**\n** #define LANG_PACK_LANG_ID 65534 (if you don't have lang.h)\n** HINSTANCE hInst = (HINSTANCE)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLANGUAGEPACKINSTANCE);\n** TCHAR buffer[9] = {0};\n** LoadString(hInst,LANG_PACK_LANG_ID,buffer,sizeof(buffer));\n**\n**\n**\n** The following example shows how using the basic api will allow you to load the playlist\n** context menu resource from the currently loaded language pack or it will fallback to\n** the default winamp.exe instance.\n**\n** HINSTANCE lang = (HINSTANCE)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLANGUAGEPACKINSTANCE);\n** HMENU popup = GetSubMenu(GetSubMenu((LoadMenu(lang?lang:GetModuleHandle(0),MAKEINTRESOURCE(101))),2),5);\n**   // do processing as needed on the menu before displaying it\n**   TrackPopupMenuEx(orig,TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON,rc.left,rc.bottom,hwnd_owner,0);\n**   DestroyMenu(popup);\n**\n** If you need a specific menu handle then look at IPC_GET_HMENU for more information.\n*/\n\n\n#define IPC_CB_PEINFOTEXT 622 // data is a string, ie: \"04:21/45:02\"\n\n\n#define IPC_CB_OUTPUTCHANGED 623 // output plugin was changed in config\n\n\n#define IPC_GETOUTPUTPLUGIN 625\n/* (requires Winamp 5.0+)\n** char* outdll = (char*)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETOUTPUTPLUGIN);\n** This returns a string of the current output plugin's dll name.\n** e.g. if the directsound plugin was selected then this would return 'out_ds.dll'.\n*/\n\n\n#define IPC_SETDRAWBORDERS 626\n/* (requires Winamp 5.0+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,enabled,IPC_SETDRAWBORDERS);\n** Set enabled to 1 to enable and 0 to disable drawing of the playlist editor and winamp\n** gen class windows (used by gen_ff to allow it to draw its own window borders).\n*/\n\n\n#define IPC_DISABLESKINCURSORS 627\n/* (requires Winamp 5.0+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,enabled,IPC_DISABLESKINCURSORS);\n** Set enabled to 1 to enable and 0 to disable the use of skinned cursors.\n*/\n\n\n#define IPC_GETSKINCURSORS 628\n/* (requires Winamp 5.36+)\n** data = (WACURSOR)cursorId. (check wa_dlg.h for values)\n*/\n\n\n#define IPC_CB_RESETFONT 629\n\n\n#define IPC_IS_FULLSCREEN 630\n/* (requires Winamp 5.0+)\n** int val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_IS_FULLSCREEN);\n** This will return 1 if the video or visualisation is in fullscreen mode or 0 otherwise.\n*/\n\n\n#define IPC_SET_VIS_FS_FLAG 631\n/* (requires Winamp 5.0+)\n** A vis should send this message with 1/as param to notify winamp that it has gone to or has come back from fullscreen mode\n*/\n\n\n#define IPC_SHOW_NOTIFICATION 632\n\n\n#define IPC_GETSKININFO 633\n#define IPC_GETSKININFOW 1633\n/* (requires Winamp 5.0+)\n** This is a notification message sent to the main Winamp window by itself whenever it\n** needs to get information to be shown about the current skin in the 'Current skin\n** information' box on the main Skins page in the Winamp preferences.\n**\n** When this notification is received and the current skin is one you are providing the\n** support for then you return a valid buffer for Winamp to be able to read from with\n** information about it such as the name of the skin file.\n**\n** if(uMsg == WM_WA_IPC && lParam == IPC_GETSKININFO){\n**   if(is_our_skin()){\n**      return is_our_skin_name();\n**   }\n** }\n*/\n\n\n#define IPC_GET_MANUALPLADVANCE 634\n/* (requires Winamp 5.03+)\n** int val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_MANUALPLADVANCE);\n** IPC_GET_MANUALPLADVANCE returns the status of the Manual Playlist Advance.\n** If enabled this will return 1 otherwise it will return 0.\n*/\n\n\n#define IPC_SET_MANUALPLADVANCE 635\n/* (requires Winamp 5.03+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SET_MANUALPLADVANCE);\n** IPC_SET_MANUALPLADVANCE sets the status of the Manual Playlist Advance option.\n** Set value = 1 to turn it on and value = 0 to turn it off.\n*/\n\n\n#define IPC_GET_NEXT_PLITEM 636\n/* (requires Winamp 5.04+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_EOF_GET_NEXT_PLITEM);\n**\n** Sent to Winamp's main window when an item has just finished playback or the next\n** button has been pressed and requesting the new playlist item number to go to.\n**\n** Subclass this message in your application to return the new item number.\n** Return -1 for normal Winamp operation (default) or the new item number in\n** the playlist to be played instead of the originally selected next track.\n**\n** This is primarily provided for the JTFE plugin (gen_jumpex.dll).\n*/\n\n\n#define IPC_GET_PREVIOUS_PLITEM 637\n/* (requires Winamp 5.04+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_EOF_GET_PREVIOUS_PLITEM);\n**\n** Sent to Winamp's main window when the previous button has been pressed and Winamp is\n** requesting the new playlist item number to go to.\n**\n** Return -1 for normal Winamp operation (default) or the new item number in\n** the playlist to be played instead of the originally selected previous track.\n**\n** This is primarily provided for the JTFE plugin (gen_jumpex.dll).\n*/\n\n\n#define IPC_IS_WNDSHADE 638\n/* (requires Winamp 5.04+)\n** int is_shaded=SendMessage(hwnd_winamp,WM_WA_IPC,wnd,IPC_IS_WNDSHADE);\n** Pass 'wnd' as an id as defined for IPC_GETWND or pass -1 to query the status of the\n** main window. This returns 1 if the window is in winshade mode and 0 if it is not.\n** Make sure you only test for this on a 5.04+ install otherwise you get a false result.\n** (See the notes about unhandled WM_WA_IPC messages).\n*/\n\n\n#define IPC_SETRATING 639 \n/* (requires Winamp 5.04+ with ML)\n** int rating=SendMessage(hwnd_winamp,WM_WA_IPC,rating,IPC_SETRATING);\n** This will allow you to set the 'rating' on the current playlist entry where 'rating'\n** is an integer value from 0 (no rating) to 5 (5 stars).\n**\n** The following example should correctly allow you to set the rating for any specified\n** playlist entry assuming of course that you're trying to get a valid playlist entry.\n**\n** void SetPlaylistItemRating(int item_to_set, int rating_to_set){\n** int cur_pos=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTPOS);\n**   SendMessage(hwnd_winamp,WM_WA_IPC,item_to_set,IPC_SETPLAYLISTPOS);\n**   SendMessage(hwnd_winamp,WM_WA_IPC,rating_to_set,IPC_SETRATING);\n**   SendMessage(hwnd_winamp,WM_WA_IPC,cur_pos,IPC_SETPLAYLISTPOS);\n** }\n*/\n\n\n#define IPC_GETRATING 640 \n/* (requires Winamp 5.04+ with ML)\n** int rating=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETRATING);\n** This returns the current playlist entry's rating between 0 (no rating) to 5 (5 stars).\n**\n** The following example should correctly allow you to get the rating for any specified\n** playlist entry assuming of course that you're trying to get a valid playlist entry.\n**\n** int GetPlaylistItemRating(int item_to_get, int rating_to_set){\n** int cur_pos=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTPOS), rating = 0;\n**   SendMessage(hwnd_winamp,WM_WA_IPC,item_to_get,IPC_SETPLAYLISTPOS);\n**   rating = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETRATING);\n**   SendMessage(hwnd_winamp,WM_WA_IPC,cur_pos,IPC_SETPLAYLISTPOS);\n**   return rating;\n** }\n*/\n\n\n#define IPC_GETNUMAUDIOTRACKS 641\n/* (requires Winamp 5.04+)\n** int n = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETNUMAUDIOTRACKS);\n** This will return the number of audio tracks available from the currently playing item.\n*/\n\n\n#define IPC_GETNUMVIDEOTRACKS 642\n/* (requires Winamp 5.04+)\n** int n = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETNUMVIDEOTRACKS);\n** This will return the number of video tracks available from the currently playing item.\n*/\n\n\n#define IPC_GETAUDIOTRACK 643\n/* (requires Winamp 5.04+)\n** int cur = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETAUDIOTRACK);\n** This will return the id of the current audio track for the currently playing item.\n*/\n\n\n#define IPC_GETVIDEOTRACK 644\n/* (requires Winamp 5.04+)\n** int cur = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVIDEOTRACK);\n** This will return the id of the current video track for the currently playing item.\n*/\n\n\n#define IPC_SETAUDIOTRACK 645\n/* (requires Winamp 5.04+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,track,IPC_SETAUDIOTRACK);\n** This allows you to switch to a new audio track (if supported) in the current playing file.\n*/\n\n\n#define IPC_SETVIDEOTRACK 646\n/* (requires Winamp 5.04+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,track,IPC_SETVIDEOTRACK);\n** This allows you to switch to a new video track (if supported) in the current playing file.\n*/\n\n\n#define IPC_PUSH_DISABLE_EXIT 647\n/* (requires Winamp 5.04+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_PUSH_DISABLE_EXIT);\n** This will let you disable or re-enable the UI exit functions (close button, context\n** menu, alt-f4). Remember to call IPC_POP_DISABLE_EXIT when you are done doing whatever\n** was required that needed to prevent exit otherwise you have to kill the Winamp process.\n*/\n\n\n#define IPC_POP_DISABLE_EXIT  648\n/* (requires Winamp 5.04+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_POP_DISABLE_EXIT);\n** See IPC_PUSH_DISABLE_EXIT\n*/\n\n\n#define IPC_IS_EXIT_ENABLED 649\n/* (requires Winamp 5.04+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_IS_EXIT_ENABLED);\n** This will return 0 if the 'exit' option of Winamp's menu is disabled and 1 otherwise.\n*/\n\n\n#define IPC_IS_AOT 650\n/* (requires Winamp 5.04+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_IS_AOT);\n** This will return the status of the always on top flag.\n** Note: This may not match the actual TOPMOST window flag while another fullscreen\n** application is focused if the user has the 'Disable always on top while fullscreen\n** applications are focused' option under the  General Preferences page is checked.\n*/\n\n\n#define IPC_USES_RECYCLEBIN 651\n/* (requires Winamp 5.09+)\n** int use_bin=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_USES_RECYCLEBIN);\n** This will return 1 if the deleted file should be sent to the recycle bin or\n** 0 if deleted files should be deleted permanently (default action for < 5.09).\n**\n** Note: if you use this on pre 5.09 installs of Winamp then it will return 1 which is\n** not correct but is due to the way that SendMessage(..) handles un-processed messages.\n** Below is a quick case for checking if the returned value is correct.\n**\n** if(SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_USES_RECYCLEBIN) &&\n**    SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVERSION)>=0x5009)\n** {\n**   // can safely follow the option to recycle the file\n** }\n** else\n*  {\n**   // need to do a permanent delete of the file\n** }\n*/\n\n\n#define IPC_FLUSHAUDITS 652\n/*\n** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_FLUSHAUDITS);\n** \n** Will flush any pending audits in the global audits queue\n**\n*/\n\n#define IPC_GETPLAYITEM_START 653\n#define IPC_GETPLAYITEM_END   654\n\n\n#define IPC_GETVIDEORESIZE 655\n#define IPC_SETVIDEORESIZE 656\n\n\n#define IPC_INITIAL_SHOW_STATE 657\n/* (requires Winamp 5.36+)\n** int show_state = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_INITIAL_SHOW_STATE);\n** returns the processed value of nCmdShow when Winamp was started\n** (see MSDN documentation the values passed to WinMain(..) for what this should be)\n**\n** e.g.\n** if(SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_INITIAL_SHOW_STATE) == SW_SHOWMINIMIZED){\n**   // we are starting minimised so process as needed (keep our window hidden)\n** }\n**\n** Useful for seeing if winamp was run minimised on startup so you can act accordingly.\n** On pre-5.36 versions this will effectively return SW_NORMAL/SW_SHOWNORMAL due to the\n** handling of unknown apis returning 1 from Winamp.\n*/\n\n// >>>>>>>>>>> Next is 658\n\n#define IPC_PLCMD  1000 \n\n#define PLCMD_ADD  0\n#define PLCMD_REM  1\n#define PLCMD_SEL  2\n#define PLCMD_MISC 3\n#define PLCMD_LIST 4\n\n//#define IPC_MBCMD  1001 \n\n#define MBCMD_BACK    0\n#define MBCMD_FORWARD 1\n#define MBCMD_STOP    2\n#define MBCMD_RELOAD  3\n#define MBCMD_MISC  4\n\n#define IPC_VIDCMD 1002 \n\n#define VIDCMD_FULLSCREEN 0\n#define VIDCMD_1X         1\n#define VIDCMD_2X         2\n#define VIDCMD_LIB        3\n#define VIDPOPUP_MISC     4\n\n//#define IPC_MBURL       1003 //sets the URL\n//#define IPC_MBGETCURURL 1004 //copies the current URL into wParam (have a 4096 buffer ready)\n//#define IPC_MBGETDESC   1005 //copies the current URL description into wParam (have a 4096 buffer ready)\n//#define IPC_MBCHECKLOCFILE 1006 //checks that the link file is up to date (otherwise updates it). wParam=parent HWND\n//#define IPC_MBREFRESH   1007 //refreshes the \"now playing\" view in the library\n//#define IPC_MBGETDEFURL 1008 //copies the default URL into wParam (have a 4096 buffer ready)\n\n#define IPC_STATS_LIBRARY_ITEMCNT 1300 // updates library count status\n\n/*\n** IPC's in the message range 2000 - 3000 are reserved internally for freeform messages.\n** These messages are taken from ff_ipc.h which is part of the Modern skin integration.\n*/\n\n#define IPC_FF_FIRST 2000\n\n#define IPC_FF_COLOURTHEME_CHANGE IPC_FF_ONCOLORTHEMECHANGED\n#define IPC_FF_ONCOLORTHEMECHANGED IPC_FF_FIRST + 3\n/*\n** This is a notification message sent when the user changes the colour theme in a Modern\n** skin and can also be detected when the Modern skin is first loaded as the gen_ff plugin\n** applies relevant settings and styles (like the colour theme).\n**\n** The value of wParam is the name of the new color theme being switched to.\n** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)(const char*)colour_theme_name,IPC_FF_ONCOLORTHEMECHANGED);\n**\n** (IPC_FF_COLOURTHEME_CHANGE is the name i (DrO) was using before getting a copy of\n** ff_ipc.h with the proper name in it).\n*/\n\n\n#define IPC_FF_ISMAINWND IPC_FF_FIRST + 4\n/*\n** int ismainwnd = (HWND)SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)(HWND)test_wnd,IPC_FF_ISMAINWND);\n**\n** This allows you to determine if the window handle passed to it is a modern skin main\n** window or not. If it is a main window or any of its windowshade variants then it will\n** return 1.\n**\n** Because of the way modern skins are implemented, it is possible for this message to\n** return a positive test result for a number of window handles within the current Winamp\n** process. This appears to be because you can have a visible main window, a compact main\n** window and also a winshaded version.\n**\n** The following code example below is one way of seeing how this api works since it will\n** enumerate all windows related to Winamp at the time and allows you to process as\n** required when a detection happens.\n**\n**\n** EnumThreadWindows(GetCurrentThreadId(),enumWndProc,0);\n**\n** BOOL CALLBACK enumWndProc(HWND hwnd, LPARAM lParam){\n**\n**   if(SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)hwnd,IPC_FF_ISMAINWND)){\n**     // do processing in here \n**     // or continue the enum for other main windows (if they exist)\n**     // and just comment out the line below\n**     return 0;\n**   }\n**   return 1;\n** }\n*/\n\n\n#define IPC_FF_GETCONTENTWND IPC_FF_FIRST + 5\n/*\n** HWND wa2embed = (HWND)SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)(HWND)test_wnd,IPC_FF_GETCONTENTWND);\n**\n** This will return the Winamp 2 window that is embedded in the window's container\n** i.e. if hwnd is the playlist editor windowshade hwnd then it will return the Winamp 2\n**      playlist editor hwnd.\n**\n** If no content is found such as the window has nothing embedded then this will return\n** the hwnd passed to it.\n*/\n\n\n#define IPC_FF_NOTIFYHOTKEY IPC_FF_FIRST + 6\n/*\n** This is a notification message sent when the user uses a global hotkey combination\n** which had been registered with the gen_hotkeys plugin.\n**\n** The value of wParam is the description of the hotkey as passed to gen_hotkeys.\n** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)(const char*)hotkey_desc,IPC_FF_NOTIFYHOTKEY);\n*/\n\n#define IPC_FF_LAST  3000\n\n\n/*\n** General IPC messages in Winamp\n**\n** All notification messages appear in the lParam of the main window message proceedure.\n*/\n\n\n#define IPC_GETDROPTARGET 3001\n/* (requires Winamp 5.0+)\n** IDropTarget* IDrop = (IDropTarget*)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETDROPTARGET);\n**\n** You call this to retrieve a copy of the IDropTarget interface which Winamp created for\n** handling external drag and drop operations on to it's Windows. This is only really\n** useful if you're providing an alternate interface and want your Windows to provide the\n** same drag and drop support as Winamp normally provides the user. Check out MSDN or\n** your prefered search facility for more information about the IDropTarget interface and\n** what's needed to handle it in your own instance.\n*/\n\n\n#define IPC_PLAYLIST_MODIFIED 3002 \n/* (requires Winamp 5.0+)\n** This is a notification message sent to the main Winamp window whenever the playlist is\n** modified in any way e.g. the addition/removal of a playlist entry.\n**\n** It is not a good idea to do large amounts of processing in this notification since it\n** will slow down Winamp as playlist entries are modified (especially when you're adding\n** in a large playlist).\n**\n** if(uMsg == WM_WA_IPC && lParam == IPC_PLAYLIST_MODIFIED)\n** {\n**   // do what you need to do here\n** }\n*/\n\n\n#define IPC_PLAYING_FILE 3003 \n/* (requires Winamp 5.0+)\n** This is a notification message sent to the main Winamp window when playback begins for\n** a file. This passes the full filepath in the wParam of the message received.\n**\n** if(uMsg == WM_WA_IPC && lParam == IPC_PLAYING_FILE)\n** {\n**   // do what you need to do here, e.g.\n**   process_file((char*)wParam);\n** }\n*/\n\n\n#define IPC_PLAYING_FILEW 13003 \n/* (requires Winamp 5.0+)\n** This is a notification message sent to the main Winamp window when playback begins for\n** a file. This passes the full filepath in the wParam of the message received.\n**\n** if(uMsg == WM_WA_IPC && lParam == IPC_PLAYING_FILEW)\n** {\n**   // do what you need to do here, e.g.\n**   process_file((wchar_t*)wParam);\n** }\n*/\n\n\n#define IPC_FILE_TAG_MAY_HAVE_UPDATED 3004\n#define IPC_FILE_TAG_MAY_HAVE_UPDATEDW 3005\n/* (requires Winamp 5.0+)\n** This is a notification message sent to the main Winamp window when a file's tag\n** (e.g. id3) may have been updated. This appears to be sent when the InfoBox(..) function\n** of the associated input plugin returns a 1 (which is the file information dialog/editor\n** call normally).\n**\n** if(uMsg == WM_WA_IPC && lParam == IPC_FILE_TAG_MAY_HAVE_UPDATED)\n** {\n**   // do what you need to do here, e.g.\n**   update_info_on_file_update((char*)wParam);\n** }\n*/\n\n\n#define IPC_ALLOW_PLAYTRACKING 3007\n/* (requires Winamp 5.0+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,allow,IPC_ALLOW_PLAYTRACKING);\n** Send allow as nonzero to allow play tracking and zero to disable the mode.\n*/\n\n\n#define IPC_HOOK_OKTOQUIT 3010 \n/* (requires Winamp 5.0+)\n** This is a notification message sent to the main Winamp window asking if it's okay to\n** close or not. Return zero to prevent Winamp from closing or return anything non-zero\n** to allow Winamp to close.\n**\n** The best implementation of this option is to let the message pass through to the\n** original window proceedure since another plugin may want to have a say in the matter\n** with regards to Winamp closing.\n**\n** if(uMsg == WM_WA_IPC && lParam == IPC_HOOK_OKTOQUIT)\n** {\n**   // do what you need to do here, e.g.\n**   if(no_shut_down())\n**   {\n**     return 1;\n**   }\n** }\n*/\n\n\n#define IPC_WRITECONFIG 3011\n/* (requires Winamp 5.0+)\n** SendMessage(hwnd_winamp,WM_WA_IPC,write_type,IPC_WRITECONFIG);\n**\n** Send write_type as 2 to write all config settings and the current playlist.\n**\n** Send write_type as 1 to write the playlist and common settings.\n** This won't save the following ini settings::\n**\n**   defext, titlefmt, proxy, visplugin_name, dspplugin_name, check_ft_startup,\n**   visplugin_num, pe_fontsize, visplugin_priority, visplugin_autoexec, dspplugin_num,\n**   sticon, splash, taskbar, dropaotfs, ascb_new, ttips, riol, minst, whichicon,\n**   whichicon2, addtolist, snap, snaplen, parent, hilite, disvis, rofiob, shownumsinpl,\n**   keeponscreen, eqdsize, usecursors, fixtitles, priority, shuffle_morph_rate,\n**   useexttitles, bifont, inet_mode, ospb, embedwnd_freesize, no_visseh\n** (the above was valid for 5.1)\n**\n** Send write_type as 0 to write the common and less common settings and no playlist.\n*/\n\n\n#define IPC_UPDATE_URL 3012\n// pass the URL (char *) in lparam, will be free()'d on done. \n\n\n#define IPC_GET_RANDFUNC 3015 // returns a function to get a random number\n/* (requires Winamp 5.1+)\n** int (*randfunc)(void) = (int(*)(void))SendMessage(plugin.hwndParent,WM_WA_IPC,0,IPC_GET_RANDFUNC);\n** if(randfunc && randfunc != 1){\n**   randfunc();\n** }\n**\n** This will return a positive 32-bit number (essentially 31-bit).\n** The check for a returned value of 1 is because that's the default return value from\n** SendMessage(..) when it is not handled so is good to check for it in this situation.\n*/\n\n\n#define IPC_METADATA_CHANGED 3017 \n/* (requires Winamp 5.1+)\n** int changed=SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)(char*)field,IPC_METADATA_CHANGED);\n** a plugin can SendMessage this to winamp if internal metadata has changes.\n** wParam should be a char * of what field changed\n**\n** Currently used for internal actions (and very few at that) the intent of this api is\n** to allow a plugin to call it when metadata has changed in the current playlist entry\n** e.g.a new id3v2 tag was found in a stream\n**\n** The wparam value can either be NULL or a pointer to an ansi string for the metadata\n** which has changed. This can be thought of as an advanced version of IPC_UPDTITLE and\n** could be used to allow for update of the current title when a specific tag changed.\n**\n** Not recommended to be used since there is not the complete handling implemented in\n** Winamp for it at the moment.\n*/\n\n\n#define IPC_SKIN_CHANGED 3018 \n/* (requires Winamp 5.1+)\n** This is a notification message sent to the main Winamp window by itself whenever\n** the skin in use is changed. There is no information sent by the wParam for this.\n**\n** if(message == WM_WA_IPC && lparam == IPC_SKIN_CHANGED)\n** {\n**   // do what you need to do to handle skin changes, e.g. call WADlg_init(hwnd_winamp);\n** }\n*/\n\n\n#define IPC_REGISTER_LOWORD_COMMAND 3019 \n/* (requires Winamp 5.1+)\n** WORD id = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_REGISTER_LOWORD_COMMAND);\n** This will assign you a unique id for making your own commands such as for extra menu\n** entries. The starting value returned by this message will potentially change as and\n** when the main resource file of Winamp is updated with extra data so assumptions cannot\n** be made on what will be returned and plugin loading order will affect things as well.\n\n** 5.33+\n** If you want to reserve more than one id, you can pass the number of ids required in wParam\n*/\n\n\n#define IPC_GET_DISPATCH_OBJECT 3020  // gets winamp main IDispatch * (for embedded webpages)\n#define IPC_GET_UNIQUE_DISPATCH_ID 3021 // gives you a unique dispatch ID that won't conflict with anything in winamp's IDispatch *\n#define IPC_ADD_DISPATCH_OBJECT 3022 // add your own dispatch object into winamp's.  This lets embedded webpages access your functions\n// pass a pointer to DispatchInfo (see below).  Winamp makes a copy of all this data so you can safely delete it later\ntypedef struct \n{\n  wchar_t *name; // filled in by plugin, make sure it's a unicode string!! (i.e. L\"myObject\" instead of \"myObject).\n  struct IDispatch *dispatch; // filled in by plugin \n  DWORD id; // filled in by winamp on return\n} DispatchInfo;\n\n// see IPC_JSAPI2_GET_DISPATCH_OBJECT for version 2 of the Dispatchable scripting interface\n\n#define IPC_GET_PROXY_STRING 3023\n/* (requires Winamp 5.11+)\n** char* proxy_string=(char*)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_PROXY_STRING);\n** This will return the same string as is shown on the General Preferences page.\n*/\n\n\n#define IPC_USE_REGISTRY 3024 \n/* (requires Winamp 5.11+)\n** int reg_enabled=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_USE_REGISTRY);\n** This will return 0 if you should leave your grubby hands off the registry (i.e. for\n** lockdown mode). This is useful if Winamp is run from a USB drive and you can't alter\n** system settings, etc.\n*/\n\n\n#define IPC_GET_API_SERVICE 3025 \n/* (requires Winamp 5.12+)\n** api_service* api_service = (api_service)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_API_SERVICE);\n** This api will return Winamp's api_service pointer (which is what Winamp3 used, heh).\n** If this api is not supported in the Winamp version that is being used at the time then\n** the returned value from this api will be 1 which is a good version check.\n**\n** As of 5.12 there is support for .w5s plugins which reside in %WinampDir%\\System and\n** are intended for common code that can be shared amongst other plugins e.g. jnetlib.w5s\n** which contains jnetlib in one instance instead of being duplicated multiple times in\n** all of the plugins which need internet access.\n**\n** Details on the .w5s specifications will come at some stage (possibly).\n*/\n\n\ntypedef struct {\n  const wchar_t *filename;\n  const wchar_t *metadata;\n  wchar_t *ret;\n  size_t retlen;\n} extendedFileInfoStructW;\n\n#define IPC_GET_EXTENDED_FILE_INFOW 3026 \n/* (requires Winamp 5.13+)\n** Pass a pointer to the above struct in wParam\n*/\n\n\n#define IPC_GET_EXTENDED_FILE_INFOW_HOOKABLE 3027\n#define IPC_SET_EXTENDED_FILE_INFOW 3028 \n/* (requires Winamp 5.13+)\n** Pass a pointer to the above struct in wParam\n*/\n\n\n#define IPC_PLAYLIST_GET_NEXT_SELECTED 3029\n/* (requires 5.2+)\n** int pl_item = SendMessage(hwnd_winamp,WM_WA_IPC,start,IPC_PLAYLIST_GET_NEXT_SELECTED);\n**\n** This works just like the ListView_GetNextItem(..) macro for ListView controls.\n** 'start' is the index of the playlist item that you want to begin the search after or\n** set this as -1 for the search to begin with the first item of the current playlist.\n**\n** This will return the index of the selected playlist according to the 'start' value or\n** it returns -1 if there is no selection or no more selected items according to 'start'.\n**\n** Quick example:\n**\n** int sel = -1;\n** // keep incrementing the start of the search so we get all of the selected entries\n** while((sel = SendMessage(hwnd_winamp,WM_WA_IPC,sel,IPC_PLAYLIST_GET_NEXT_SELECTED))!=-1){\n**   // show the playlist file entry of the selected item(s) if there were any\n**   MessageBox(hwnd_winamp,(char*)SendMessage(hwnd_winamp,WM_WA_IPC,sel,IPC_GETPLAYLISTFILE),0,0);\n** }\n*/\n\n\n#define IPC_PLAYLIST_GET_SELECTED_COUNT 3030\n/* (requires 5.2+)\n** int selcnt = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_PLAYLIST_GET_SELECTED_COUNT);\n** This will return the number of selected playlist entries.\n*/\n\n\n#define IPC_GET_PLAYING_FILENAME 3031\n// returns wchar_t * of the currently playing filename\n\n#define IPC_OPEN_URL 3032\n// send either ANSI or Unicode string (it'll figure it out, but it MUST start with \"h\"!, so don't send ftp:// or anything funny)\n// you can also send this one from another process via WM_COPYDATA (unicode only)\n\n\n#define IPC_USE_UXTHEME_FUNC 3033\n/* (requires Winamp 5.35+)\n** int ret = SendMessage(hwnd_winamp,WM_WA_IPC,param,IPC_USE_UXTHEME_FUNC);\n** param can be IPC_ISWINTHEMEPRESENT or IPC_ISAEROCOMPOSITIONACTIVE or a valid hwnd.\n**\n** If you pass a hwnd then it will apply EnableThemeDialogTexture(ETDT_ENABLETAB)\n** so your tabbed dialogs can use the correct theme (on supporting OSes ie XP+).\n**\n** Otherwise this will return a value based on the param passed (as defined below).\n** For compatability, the return value will be zero on success (as 1 is returned\n** for unsupported ipc calls on older Winamp versions)\n*/\n  #define IPC_ISWINTHEMEPRESENT 0\n/* This will return 0 if uxtheme.dll is present\n** int isthemethere = !SendMessage(hwnd_winamp,WM_WA_IPC,IPC_ISWINTHEMEPRESENT,IPC_USE_UXTHEME_FUNC);\n*/\n  #define IPC_ISAEROCOMPOSITIONACTIVE 1\n/* This will return 0 if aero composition is active\n** int isaero = !SendMessage(hwnd_winamp,WM_WA_IPC,IPC_ISAEROCOMPOSITIONACTIVE,IPC_USE_UXTHEME_FUNC);\n*/\n\n\n#define IPC_GET_PLAYING_TITLE 3034\n// returns wchar_t * of the current title\n\n\n#define IPC_CANPLAY 3035\n// pass const wchar_t *, returns an in_mod * or 0\n\n\ntypedef struct {\n  // fill these in...\n  size_t size; // init to sizeof(artFetchData)\n  HWND parent; // parent window of the dialogue\n\n  // fill as much of these in as you can, otherwise leave them 0\n  const wchar_t *artist;\n  const wchar_t *album;\n  int year, amgArtistId, amgAlbumId;\n\n  int showCancelAll; // if set to 1, this shows a \"Cancel All\" button on the dialogue\n\n  // winamp will fill these in if the call returns successfully:\n  void* imgData; // a buffer filled with compressed image data. free with WASABI_API_MEMMGR->sysFree()\n  int imgDataLen; // the size of the buffer\n  wchar_t type[10]; // eg: \"jpg\"\n  const wchar_t *gracenoteFileId; // if you know it\n} artFetchData;\n\n#define IPC_FETCH_ALBUMART 3036\n/* pass an artFetchData*. This will show a dialog guiding the use through choosing art, and return when it's finished\n** return values:\n** 1: error showing dialog\n** 0: success\n** -1: cancel was pressed\n** -2: cancel all was pressed\n*/\n\n#define IPC_JSAPI2_GET_DISPATCH_OBJECT 3037\n/* pass your service's unique ID, as a wchar_t * string, in wParam\n** Winamp will copy the string, so don't worry about keeping it around\n** An IDispatch * object will be returned (cast the return value from SendMessage)\n** This IDispatch can be used for scripting/automation/VB interaction\n** Pass to IE via IDocHostUIHandler::GetExternal and it will become window.external in javscript\n*/\n\n#define IPC_REGISTER_WINAMP_IPCMESSAGE 65536 \n/* (requires Winamp 5.0+)\n** DWORD id = SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)name,IPC_REGISTER_WINAMP_IPCMESSAGE);\n** The value 'id' returned is > 65536 and is incremented on subsequent calls for unique\n** 'name' values passed to it. By using the same 'name' in different plugins will allow a\n** common runtime api to be provided for the currently running instance of Winamp\n** e.g.\n**   PostMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)my_param,registered_ipc);\n** Have a look at wa_hotkeys.h for an example on how this api is used in practice for a\n** custom WM_WA_IPC message.\n**\n** if(uMsg == WM_WA_IPC && lParam == id_from_register_winamp_ipcmessage){\n**   // do things\n** }\n*/\n\n#endif//_WA_IPC_H_"
  },
  {
    "path": "img/dyauno/Style.inc",
    "content": "<style type=\"text/css\">\n/*!normalize.css v3.0.1 | MIT License | git.io/normalize*/body,h1,h2,html,mark{color:#000}blockquote,h6{color:#777}code,table tr:nth-child(2n),tt{background-color:#f8f8f8}code,h3,h4,h5,tt{color:#333}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background:0 0;color:#4183c4;text-decoration:none}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,optgroup,strong{font-weight:700}dfn{font-style:italic}mark{background:#ff0}small{font-size:80%}sup{top:-.5em}img{border:0;max-width:100%}svg:not(:root){overflow:hidden}figure{margin:1em 8px}hr{-moz-box-sizing:content-box;box-sizing:content-box}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}textarea{overflow:auto}td,th{padding:0}.caption{margin-bottom:5em}body,html{margin:auto;padding-right:1em;padding-left:1em;max-width:57em}:not('#mkdbuttons'){margin:0;padding:0}body{font:13.34px helvetica,arial,freesans,clean,sans-serif;-webkit-font-smoothing:subpixel-antialiased;background:#fff;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;padding:30px;margin:15px;font-size:14px;line-height:1.6}dl dt,h1,h2,h3,h4,h5,h6{font-weight:700;padding:0}body>:first-child{margin-top:0!important}body>:last-child{margin-bottom:0!important}h1,h2,h3,h4,h5,h6{margin:20px 0 10px;-webkit-font-smoothing:subpixel-antialiased;cursor:text}h1{font-size:28px}h2{font-size:24px;border-bottom:1px solid #ccc}h3{font-size:18px}h4{font-size:16px}dl dt,h5,h6{font-size:14px}blockquote,p,pre,table{margin:15px 0}ol,ul{padding-left:30px}blockquote>:first-child,dl dd>:first-child,dl dt>:first-child,h1+p,h2+p,h3+p,h4+p,h5+p,h6+p,ol li ul:first-of-type,ol li>:first-child,ul li>:first-child{margin-top:0}hr{background:url('data:image/png; base64, iVBORw0KGgoAAAANSUhEUgAAAAYAAAAECAYAAACtBE5DAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OENDRjNBN0E2NTZBMTFFMEI3QjRBODM4NzJDMjlGNDgiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6OENDRjNBN0I2NTZBMTFFMEI3QjRBODM4NzJDMjlGNDgiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo4Q0NGM0E3ODY1NkExMUUwQjdCNEE4Mzg3MkMyOUY0OCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo4Q0NGM0E3OTY1NkExMUUwQjdCNEE4Mzg3MkMyOUY0OCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PqqezsUAAAAfSURBVHjaYmRABcYwBiM2QSA4y4hNEKYDQxAEAAIMAHNGAzhkPOlYAAAAAElFTkSuQmCC') repeat-x;border:0;color:#ccc;height:4px;padding:0}a:first-child h1,a:first-child h2,a:first-child h3,a:first-child h4,a:first-child h5,a:first-child h6,body>h1:first-child,body>h1:first-child+h2,body>h2:first-child,body>h3:first-child,body>h4:first-child,body>h5:first-child,body>h6:first-child{margin-top:0;padding-top:0}table td,table th{border:1px solid #ccc;padding:6px 13px}dl,dl dt:first-child{padding:0}dl dt{font-style:italic;margin:15px 0 5px}blockquote>:last-child,dl dd>:last-child,dl dt>:last-child{margin-bottom:0}dl dd{margin:0 0 15px;padding:0 15px}blockquote{border-left:4px solid #DDD;padding:0 15px}table{border-collapse:collapse;border-spacing:0;font:inherit}.highlight .c,.highlight .c1,.highlight .cm,.highlight .cs,.highlight .ge,.poetry pre{font-style:italic}.highlight .cp,.highlight .cs,.highlight .gs,.highlight .k,.highlight .kc,.highlight .kd,.highlight .kn,.highlight .kp,.highlight .kr,.highlight .kt,.highlight .nc,.highlight .ne,.highlight .nf,.highlight .o,.highlight .ow,table th{font-weight:700}table tr{border-top:1px solid #ccc;background-color:#fff}code,tt{margin:0 2px;padding:0 5px;white-space:nowrap;border:1px solid #eaeaea;border-radius:3px;font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px}.poetry pre,.poetry pre code{font-family:Georgia,Garamond,serif!important}pre>code{margin:0;padding:0;white-space:pre;border:0;background:0 0}.highlight pre,pre{background-color:#f8f8f8;border:1px solid #ccc;font-size:13px;line-height:19px;overflow:auto;padding:6px 10px;border-radius:3px}pre code,pre tt{background-color:transparent;border:0}.poetry pre{font-size:110%!important;line-height:1.6em;display:block;margin-left:1em}.poetry pre code{word-break:break-all;word-break:break-word;-webkit-hyphens:auto;-moz-hyphens:auto;hyphens:auto;white-space:pre-wrap}a.footnote,sub,sup{font-size:1.4ex;height:0;line-height:1;vertical-align:super;position:relative}sub{bottom:-.25em;vertical-align:sub;top:-1px}@media print{body,pre{background:#fff}body{border:0}blockquote,figure,img,pre,table{page-break-inside:avoid}code{background-color:#fff;color:#333!important;padding:0 .2em;border:1px solid #dedede}pre code{background-color:#fff!important;overflow:visible}}@media screen{body{box-shadow:0 0 0 1px #cacaca,0 0 0 4px #eee}.inverted .math,.inverted blockquote,.inverted body,.inverted caption,.inverted dd,.inverted dt,.inverted h1,.inverted h2,.inverted h3,.inverted h4,.inverted h5,.inverted h6,.inverted hr .inverted p,.inverted li,.inverted td,.inverted th,body.inverted{color:#eee!important;border-color:#555;box-shadow:none}.inverted td,.inverted th{background:#333}.inverted h2{border-color:#555}.inverted hr{border-color:#777;border-width:1px!important}::selection{background:rgba(157,193,200,.5)}h1::selection{background-color:rgba(45,156,208,.3)}h2::selection{background-color:rgba(90,182,224,.3)}h3::selection,h4::selection,h5::selection,h6::selection,li::selection,ol::selection{background-color:rgba(133,201,232,.3)}code::selection{background-color:rgba(0,0,0,.7);color:#eee}code span::selection{background-color:rgba(0,0,0,.7)!important;color:#eee!important}a::selection{background-color:rgba(255,230,102,.2)}.inverted a::selection{background-color:rgba(255,230,102,.6)}caption::selection,td::selection,th::selection{background-color:rgba(180,237,95,.5)}.inverted,.inverted body{background:#252a2a}.inverted a{color:#acd1d5}}.highlight .c{color:#998}.highlight .err{color:#a61717;background-color:#e3d2d2}.highlight .cm{color:#998}.highlight .cp{color:#999}.highlight .c1{color:#998}.highlight .cs{color:#999}.highlight .gd{color:#000;background-color:#fdd}.highlight .gd .x{color:#000;background-color:#faa}.highlight .gr{color:#a00}.highlight .gh{color:#999}.highlight .gi{color:#000;background-color:#dfd}.highlight .gi .x{color:#000;background-color:#afa}.highlight .go{color:#888}.highlight .gp{color:#555}.highlight .gu{color:purple;font-weight:700}.highlight .gt{color:#a00}.highlight .kt{color:#458}.highlight .m{color:#099}.highlight .s{color:#d14}.highlight .na{color:teal}.highlight .nb{color:#0086b3}.highlight .nc{color:#458}.highlight .no{color:teal}.highlight .ni{color:purple}.highlight .ne,.highlight .nf{color:#900}.highlight .nn{color:#555}.highlight .nt{color:navy}.highlight .nv{color:teal}.highlight .w{color:#bbb}.highlight .mf,.highlight .mh,.highlight .mi,.highlight .mo{color:#099}.highlight .s2,.highlight .sb,.highlight .sc,.highlight .sd,.highlight .se,.highlight .sh,.highlight .si,.highlight .sx{color:#d14}.highlight .sr{color:#009926}.highlight .s1{color:#d14}.highlight .ss{color:#990073}.highlight .bp{color:#999}.highlight .vc,.highlight .vg,.highlight .vi{color:teal}.highlight .il{color:#099}.highlight .gc{color:#999;background-color:#eaf2f5}.type-csharp .highlight .k,.type-csharp .highlight .kt{color:#00F}.type-csharp .highlight .nf{color:#000;font-weight:400}.type-csharp .highlight .nc{color:#2b91af}.type-csharp .highlight .nn{color:#000}.type-csharp .highlight .s,.type-csharp .highlight .sc{color:#a31515}\n</style>"
  },
  {
    "path": "z_build.bat",
    "content": "@echo off\nsetlocal enabledelayedexpansion\n\nREM ///////////////////////////////////////////////////////////////////////////\nREM // Set Paths\nREM ///////////////////////////////////////////////////////////////////////////\nset \"MSVC_PATH=C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\"\nset \"TOOLS_VER=141\"\nset \"SLN_SUFFX=VS2017\"\n\nREM ###############################################\nREM # DO NOT MODIFY ANY LINES BELOW THIS LINE !!! #\nREM ###############################################\n\nREM ///////////////////////////////////////////////////////////////////////////\nREM // Check environment\nREM ///////////////////////////////////////////////////////////////////////////\nif not exist \"%MSVC_PATH%\\vcvarsall.bat\" (\n\tif not exist \"%MSVC_PATH%\\Auxiliary\\Build\\vcvarsall.bat\" (\n\t\techo MSVC compiler not found. Please check your MSVC_PATH var^^!\n\t\tgoto BuildError\n\t)\n)\n\nif not exist \"%QTDIR%\\bin\\moc.exe\" (\n\techo Qt could not be found. Please check your QTDIR var^^!\n\tgoto BuildError\n)\nif not exist \"%QTDIR%\\include\\QtCore\\qglobal.h\" (\n\techo Qt could not be found. Please check your QTDIR var^^!\n\tgoto BuildError\n)\n\nif not exist \"%JAVA_HOME%\\bin\\java.exe\" (\n\techo JDK could not be found. Please check your JAVA_HOME var^^!\n\tgoto BuildError\n)\nif not exist \"%JAVA_HOME%\\lib\\tools.jar\" (\n\techo JDK could not be found. Please check your JAVA_HOME var^^!\n\tgoto BuildError\n)\nif not exist \"%JAVA_HOME%\\include\\jni.h\" (\n\techo JDK could not be found. Please check your JAVA_HOME var^^!\n\tgoto BuildError\n)\n\nif not exist \"%~dp0\\..\\Prerequisites\\README.txt\" (\n\techo Prerequisites not found. Repair your build environment^^!\n\tgoto BuildError\n)\n\nREM ///////////////////////////////////////////////////////////////////////////\nREM // Setup environment\nREM ///////////////////////////////////////////////////////////////////////////\nset \"ANT_HOME=%~dp0\\..\\Prerequisites\\Ant\"\nset \"PATH=%QTDIR%\\bin;%JAVA_HOME%\\bin;%ANT_HOME%\\bin;%PATH%\"\n\nif exist \"%MSVC_PATH%\\vcvarsall.bat\" (\n\tcall \"%MSVC_PATH%\\vcvarsall.bat\" x86\n) else (\n\tif exist \"%MSVC_PATH%\\Auxiliary\\Build\\vcvarsall.bat\" (\n\t\tcall \"%MSVC_PATH%\\Auxiliary\\Build\\vcvarsall.bat\" x86\n\t)\n)\n\nif not exist \"%VCINSTALLDIR%\\bin\\cl.exe\" (\n\tif not exist \"%VCToolsInstallDir%\\bin\\Hostx64\\x86\\cl.exe\" (\n\t\techo MSVC compiler not found. Please check your MSVC_PATH var^^!\n\t\tgoto BuildError\n\t)\n)\n\nREM ///////////////////////////////////////////////////////////////////////////\nREM // Get current date and time (in ISO format)\nREM ///////////////////////////////////////////////////////////////////////////\nset \"ISO_DATE=\"\nset \"ISO_TIME=\"\n\nif not exist \"%~dp0\\..\\Prerequisites\\GnuWin32\\date.exe\" goto BuildError\n\nfor /F \"tokens=1,2 delims=:\" %%a in ('\"%~dp0\\..\\Prerequisites\\GnuWin32\\date.exe\" +ISODATE:%%Y-%%m-%%d') do (\n\tif \"%%a\"==\"ISODATE\" set \"ISO_DATE=%%b\"\n)\nfor /F \"tokens=1,2,3,4 delims=:\" %%a in ('\"%~dp0\\..\\Prerequisites\\GnuWin32\\date.exe\" +ISOTIME:%%T') do (\n\tif \"%%a\"==\"ISOTIME\" set \"ISO_TIME=%%b:%%c:%%d\"\n)\n\nif \"%ISO_DATE%\"==\"\" goto BuildError\nif \"%ISO_TIME%\"==\"\" goto BuildError\n\nREM ///////////////////////////////////////////////////////////////////////////\nREM // Detect version number\nREM ///////////////////////////////////////////////////////////////////////////\nset \"VER_MAJOR=\"\nset \"VER_MINOR=\"\nset \"VER_PATCH=\"\n\nfor /F \"tokens=1,2,3\" %%a in (%~dp0\\DynamicAudioNormalizerShared\\res\\version.inc) do (\n\tif \"%%a\"==\"#define\" (\n\t\tif \"%%b\"==\"VER_DYNAUDNORM_MAJOR\"    set \"VER_MAJOR=%%c\"\n\t\tif \"%%b\"==\"VER_DYNAUDNORM_MINOR_HI\" set \"VER_MINOR=%%c!VER_MINOR!\"\n\t\tif \"%%b\"==\"VER_DYNAUDNORM_MINOR_LO\" set \"VER_MINOR=!VER_MINOR!%%c\"\n\t\tif \"%%b\"==\"VER_DYNAUDNORM_PATCH\"    set \"VER_PATCH=%%c\"\n\t)\n)\n\nif \"%VER_MAJOR%\"==\"\" goto BuildError\nif \"%VER_MINOR%\"==\"\" goto BuildError\nif \"%VER_PATCH%\"==\"\" goto BuildError\n\nREM ///////////////////////////////////////////////////////////////////////////\nREM // Clean Binaries\nREM ///////////////////////////////////////////////////////////////////////////\nfor /d %%d in (%~dp0\\bin\\*) do (rmdir /S /Q \"%%~d\")\nfor /d %%d in (%~dp0\\obj\\*) do (rmdir /S /Q \"%%~d\")\n\nREM ///////////////////////////////////////////////////////////////////////////\nREM // Build the binaries\nREM ///////////////////////////////////////////////////////////////////////////\nfor %%c in (DLL, Static) do (\n\tfor %%p in (Win32, x64) do (\n\t\techo ---------------------------------------------------------------------\n\t\techo BEGIN BUILD [%%p/Release_%%c]\n\t\techo ---------------------------------------------------------------------\n\n\t\tMSBuild.exe /property:Platform=%%p /property:Configuration=Release_%%c /target:clean   \"%~dp0\\DynamicAudioNormalizer_%SLN_SUFFX%.sln\"\n\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\tMSBuild.exe /property:Platform=%%p /property:Configuration=Release_%%c /target:rebuild \"%~dp0\\DynamicAudioNormalizer_%SLN_SUFFX%.sln\"\n\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\tMSBuild.exe /property:Platform=%%p /property:Configuration=Release_%%c /target:build   \"%~dp0\\DynamicAudioNormalizer_%SLN_SUFFX%.sln\"\n\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t)\n)\n\ncall \"%ANT_HOME%\\bin\\ant.bat\" -buildfile \"%~dp0\\DynamicAudioNormalizerJNI\\build.xml\"\nif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\nREM ///////////////////////////////////////////////////////////////////////////\nREM // Copy program files\nREM ///////////////////////////////////////////////////////////////////////////\nset \"PACK_PATH=%TMP%\\~%RANDOM%%RANDOM%.tmp\"\nmkdir \"%PACK_PATH%\"\n\nfor %%c in (DLL, Static) do (\n\techo ---------------------------------------------------------------------\n\techo BEGIN PACKAGING [Release_%%c]\n\techo ---------------------------------------------------------------------\n\t\n\tmkdir \"%PACK_PATH%\\%%c\"\n\tmkdir \"%PACK_PATH%\\%%c\\x64\"\n\tmkdir \"%PACK_PATH%\\%%c\\img\"\n\tmkdir \"%PACK_PATH%\\%%c\\img\\dyauno\"\n\tmkdir \"%PACK_PATH%\\%%c\\include\"\n\tmkdir \"%PACK_PATH%\\%%c\\samples\"\n\tmkdir \"%PACK_PATH%\\%%c\\samples\\python\"\n\n\tcopy \"%~dp0\\bin\\Win32\\v%TOOLS_VER%_xp\\Release_%%c\\DynamicAudioNormalizerCLI.exe\"            \"%PACK_PATH%\\%%c\"\n\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\tcopy \"%~dp0\\bin\\Win32\\v%TOOLS_VER%_xp\\Release_%%c\\DynamicAudioNormalizerGUI.exe\"            \"%PACK_PATH%\\%%c\"\n\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\tcopy \"%~dp0\\bin\\Win32\\v%TOOLS_VER%_xp\\Release_%%c\\DynamicAudioNormalizerPYD.pyd\"            \"%PACK_PATH%\\%%c\"\n\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\tcopy \"%~dp0\\bin\\x64\\.\\v%TOOLS_VER%_xp\\Release_%%c\\DynamicAudioNormalizerPYD.pyd\"            \"%PACK_PATH%\\%%c\\x64\"\n\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\tcopy \"%~dp0\\bin\\Win32\\v%TOOLS_VER%_xp\\Release_%%c\\DynamicAudioNormalizerVST.dll\"            \"%PACK_PATH%\\%%c\"\n\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\tcopy \"%~dp0\\bin\\x64\\.\\v%TOOLS_VER%_xp\\Release_%%c\\DynamicAudioNormalizerVST.dll\"            \"%PACK_PATH%\\%%c\\x64\"\n\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\tcopy \"%~dp0\\bin\\Win32\\v%TOOLS_VER%_xp\\Release_%%c\\DynamicAudioNormalizerWA5.dll\"            \"%PACK_PATH%\\%%c\"\n\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\n\tcopy \"%~dp0\\DynamicAudioNormalizerPYD\\include\\*.py\"                                         \"%PACK_PATH%\\%%c\\include\"\n\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\tcopy \"%~dp0\\DynamicAudioNormalizerPYD\\samples\\*.py\"                                         \"%PACK_PATH%\\%%c\\samples\\python\"\n\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\n\tif /I \"%%c\"==\"DLL\" (\n\t\tmkdir \"%PACK_PATH%\\%%c\\redist\"\n\t\tmkdir \"%PACK_PATH%\\%%c\\samples\\delphi\"\n\t\tmkdir \"%PACK_PATH%\\%%c\\samples\\dotNet\"\n\t\tmkdir \"%PACK_PATH%\\%%c\\samples\\java\"\n\t\t\n\t\tcopy \"%~dp0\\bin\\Win32\\v%TOOLS_VER%_xp\\Release_%%c\\DynamicAudioNormalizerAPI.dll\"        \"%PACK_PATH%\\%%c\"\n\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\tcopy \"%~dp0\\bin\\Win32\\v%TOOLS_VER%_xp\\Release_%%c\\DynamicAudioNormalizerAPI.lib\"        \"%PACK_PATH%\\%%c\"\n\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\tcopy \"%~dp0\\bin\\Win32\\v%TOOLS_VER%_xp\\Release_%%c\\DynamicAudioNormalizerNET.dll\"        \"%PACK_PATH%\\%%c\"\n\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\tcopy \"%~dp0\\bin\\x64\\.\\v%TOOLS_VER%_xp\\Release_%%c\\DynamicAudioNormalizerAPI.dll\"        \"%PACK_PATH%\\%%c\\x64\"\n\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\tcopy \"%~dp0\\bin\\x64\\.\\v%TOOLS_VER%_xp\\Release_%%c\\DynamicAudioNormalizerAPI.lib\"        \"%PACK_PATH%\\%%c\\x64\"\n\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\tcopy \"%~dp0\\bin\\x64\\.\\v%TOOLS_VER%_xp\\Release_%%c\\DynamicAudioNormalizerNET.dll\"        \"%PACK_PATH%\\%%c\\x64\"\n\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\tcopy \"%~dp0\\DynamicAudioNormalizerAPI\\include\\*.h\"                                      \"%PACK_PATH%\\%%c\\include\"\n\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\tcopy \"%~dp0\\DynamicAudioNormalizerPAS\\include\\*.pas\"                                    \"%PACK_PATH%\\%%c\\include\"\n\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\tcopy \"%~dp0\\DynamicAudioNormalizerJNI\\out\\*.jar\"                                        \"%PACK_PATH%\\%%c\"\n\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\tcopy \"%~dp0\\..\\Prerequisites\\LibSndFile\\bin\\Win32\\libsndfile-1.dll\"                     \"%PACK_PATH%\\%%c\"\n\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\tcopy \"%~dp0\\..\\Prerequisites\\LibMpg123\\bin\\Win32\\libmpg123.v%TOOLS_VER%_xp.dll\"         \"%PACK_PATH%\\%%c\\libmpg123.dll\"\n\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\tcopy \"%~dp0\\..\\Prerequisites\\XiphAudioLibs\\bin\\Win32\\libopus.v%TOOLS_VER%_xp.dll\"       \"%PACK_PATH%\\%%c\\libopus.dll\"\n\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\tcopy \"%~dp0\\..\\Prerequisites\\XiphAudioLibs\\bin\\Win32\\libopusfile.v%TOOLS_VER%_xp.dll\"   \"%PACK_PATH%\\%%c\\libopusfile.dll\"\n\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\tcopy \"%~dp0\\..\\Prerequisites\\XiphAudioLibs\\bin\\Win32\\libogg.v%TOOLS_VER%_xp.dll\"        \"%PACK_PATH%\\%%c\\libogg.dll\"\n\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\tcopy \"%~dp0\\..\\Prerequisites\\Qt4\\v%TOOLS_VER%_xp\\Shared\\bin\\QtGui4.dll\"                 \"%PACK_PATH%\\%%c\"\n\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\tcopy \"%~dp0\\..\\Prerequisites\\Qt4\\v%TOOLS_VER%_xp\\Shared\\bin\\QtCore4.dll\"                \"%PACK_PATH%\\%%c\"\n\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\tcopy \"%~dp0\\DynamicAudioNormalizerNET\\samples\\*.cs\"                                     \"%PACK_PATH%\\%%c\\samples\\dotNet\"\n\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\tcopy \"%~dp0\\DynamicAudioNormalizerNET\\samples\\*.vb\"                                     \"%PACK_PATH%\\%%c\\samples\\dotNet\"\n\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\tcopy \"%~dp0\\DynamicAudioNormalizerPAS\\src\\*.pas\"                                        \"%PACK_PATH%\\%%c\\samples\\delphi\"\n\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\tcopy \"%~dp0\\DynamicAudioNormalizerPAS\\src\\*.dfm\"                                        \"%PACK_PATH%\\%%c\\samples\\delphi\"\n\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\tcopy \"%~dp0\\DynamicAudioNormalizerJNI\\samples\\com\\muldersoft\\dynaudnorm\\samples\\*.java\" \"%PACK_PATH%\\%%c\\samples\\java\"\n\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\t\n\t\tif %TOOLS_VER% GEQ 140 (\n\t\t\tif %TOOLS_VER% GEQ 141 (\n\t\t\t\tcopy \"%VCToolsRedistDir%\\x86\\Microsoft.VC%TOOLS_VER%.CRT\\*.dll\"                 \"%PACK_PATH%\\%%c\"\n\t\t\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\t\t\tcopy \"%VCToolsRedistDir%\\x64\\Microsoft.VC%TOOLS_VER%.CRT\\*.dll\"                 \"%PACK_PATH%\\%%c\\x64\"\n\t\t\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\t\t\tcopy \"%VCToolsRedistDir%\\vcredist_*.exe\"                                        \"%PACK_PATH%\\%%c\\redist\"\n\t\t\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\t\t) else (\n\t\t\t\tcopy \"%MSVC_PATH%\\redist\\x86\\Microsoft.VC%TOOLS_VER%.CRT\\*.dll\"                 \"%PACK_PATH%\\%%c\"\n\t\t\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\t\t\tcopy \"%MSVC_PATH%\\redist\\x64\\Microsoft.VC%TOOLS_VER%.CRT\\*.dll\"                 \"%PACK_PATH%\\%%c\\x64\"\n\t\t\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\t\t\tcopy \"%MSVC_PATH%\\redist\\1033\\vcredist_*.exe\"                                   \"%PACK_PATH%\\%%c\\redist\"\n\t\t\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\t\t)\n\t\t\tcopy \"%~dp0\\..\\Prerequisites\\MSVC\\redist\\ucrt\\DLLs\\x86\\*.dll\"                       \"%PACK_PATH%\\%%c\"\n\t\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\t\tcopy \"%~dp0\\..\\Prerequisites\\MSVC\\redist\\ucrt\\DLLs\\x64\\*.dll\"                       \"%PACK_PATH%\\%%c\\x64\"\n\t\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t\t)\n\t)\n\n\tcopy \"%~dp0\\LICENSE-LGPL.html\"                                                              \"%PACK_PATH%\\%%c\"\n\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\tcopy \"%~dp0\\LICENSE-GPL2.html\"                                                              \"%PACK_PATH%\\%%c\"\n\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\tcopy \"%~dp0\\LICENSE-GPL3.html\"                                                              \"%PACK_PATH%\\%%c\"\n\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\tcopy \"%~dp0\\img\\dyauno\\*.png\"                                                               \"%PACK_PATH%\\%%c\\img\\dyauno\"\n\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\n\t\"%~dp0\\..\\Prerequisites\\Pandoc\\pandoc.exe\" --from markdown_github+pandoc_title_block+header_attributes+implicit_figures --to html5 --toc -N --standalone -H \"%~dp0\\..\\Prerequisites\\Pandoc\\css\\github-pandoc.inc\" \"%~dp0\\README.md\" | \"%JAVA_HOME%\\bin\\java.exe\" -jar \"%~dp0\\..\\Prerequisites\\HTMLCompressor\\bin\\htmlcompressor-1.5.3.jar\" --compress-css -o \"%PACK_PATH%\\%%c\\README.html\"\n\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n)\n\nREM ///////////////////////////////////////////////////////////////////////////\nREM // Compress\nREM ///////////////////////////////////////////////////////////////////////////\nfor %%c in (Static) do (\n\tfor %%i in (DynamicAudioNormalizerCLI.exe,DynamicAudioNormalizerGUI.exe,DynamicAudioNormalizerPYD.pyd,DynamicAudioNormalizerVST.dll,DynamicAudioNormalizerWA5.dll) do (\n\t\t\"%~dp0\\..\\Prerequisites\\UPX\\upx.exe\" --best \"%PACK_PATH%\\%%c\\%%~i\"\n\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t)\n\tfor %%i in (DynamicAudioNormalizerPYD.pyd,DynamicAudioNormalizerVST.dll) do (\n\t\t\"%~dp0\\..\\Prerequisites\\UPX\\upx.exe\" --best \"%PACK_PATH%\\%%c\\x64\\%%~i\"\n\t\tif not \"!ERRORLEVEL!\"==\"0\" goto BuildError\n\t)\n)\n\nREM ///////////////////////////////////////////////////////////////////////////\nREM // Create version tag\nREM ///////////////////////////////////////////////////////////////////////////\necho Dynamic Audio Normalizer>                                                                                                                     \"%PACK_PATH%\\BUILD_TAG\"\necho Copyright (c) 2014-2019 LoRd_MuldeR ^<MuldeR2@GMX.de^>. Some rights reserved.>>                                                               \"%PACK_PATH%\\BUILD_TAG\"\necho.>>                                                                                                                                            \"%PACK_PATH%\\BUILD_TAG\"\necho Version %VER_MAJOR%.%VER_MINOR%-%VER_PATCH%. Built on %ISO_DATE%, at %ISO_TIME%>>                                                             \"%PACK_PATH%\\BUILD_TAG\"\necho.>>                                                                                                                                            \"%PACK_PATH%\\BUILD_TAG\"\ncl.exe 2>&1 | \"%~dp0\\..\\Prerequisites\\GnuWin32\\head.exe\" -n1 | \"%~dp0\\..\\Prerequisites\\GnuWin32\\sed.exe\" -e \"/^$/d\" -e \"s/^/Compiler version: /\">> \"%PACK_PATH%\\BUILD_TAG\"\nver    2>&1 |                                                  \"%~dp0\\..\\Prerequisites\\GnuWin32\\sed.exe\" -e \"/^$/d\" -e \"s/^/Build platform:   /\">> \"%PACK_PATH%\\BUILD_TAG\"\necho.>>                                                                                                                                            \"%PACK_PATH%\\BUILD_TAG\"\necho This library is free software; you can redistribute it and/or>>                                                                               \"%PACK_PATH%\\BUILD_TAG\"\necho modify it under the terms of the GNU Lesser General Public>>                                                                                  \"%PACK_PATH%\\BUILD_TAG\"\necho License as published by the Free Software Foundation; either>>                                                                                \"%PACK_PATH%\\BUILD_TAG\"\necho version 2.1 of the License, or (at your option) any later version.>>                                                                          \"%PACK_PATH%\\BUILD_TAG\"\necho.>>                                                                                                                                            \"%PACK_PATH%\\BUILD_TAG\"\necho This library is distributed in the hope that it will be useful,>>                                                                             \"%PACK_PATH%\\BUILD_TAG\"\necho but WITHOUT ANY WARRANTY; without even the implied warranty of>>                                                                              \"%PACK_PATH%\\BUILD_TAG\"\necho MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU>>                                                                           \"%PACK_PATH%\\BUILD_TAG\"\necho Lesser General Public License for more details.>>                                                                                             \"%PACK_PATH%\\BUILD_TAG\"\n\nREM ///////////////////////////////////////////////////////////////////////////\nREM // Attributes\nREM ///////////////////////////////////////////////////////////////////////////\nfor %%c in (DLL, Static) do (\n\tattrib +R \"%PACK_PATH%\\%%c\\*\"\n\tattrib +R \"%PACK_PATH%\\%%c\\x64\\*\"\n\tattrib +R \"%PACK_PATH%\\%%c\\img\\dyauno\\*\"\n\tif /I \"%%c\"==\"DLL\" (\n\t\tattrib +R \"%PACK_PATH%\\%%c\\include\\*\"\n\t)\n)\n\nREM ///////////////////////////////////////////////////////////////////////////\nREM // Generate outfile name\nREM ///////////////////////////////////////////////////////////////////////////\nmkdir \"%~dp0\\out\" 2> NUL\nset \"OUT_NAME=DynamicAudioNormalizer.%ISO_DATE%\"\n:CheckOutName\nfor %%c in (DLL, Static) do (\n\tif exist \"%~dp0\\out\\%OUT_NAME%.%%c.zip\" (\n\t\tset \"OUT_NAME=%OUT_NAME%.new\"\n\t\tgoto CheckOutName\n\t)\n)\n\nREM ///////////////////////////////////////////////////////////////////////////\nREM // Build the package\nREM ///////////////////////////////////////////////////////////////////////////\nfor %%c in (DLL, Static) do (\n\tcopy \"%PACK_PATH%\\BUILD_TAG\" \"%PACK_PATH%\\%%c\"\n\tpushd \"%PACK_PATH%\\%%c\"\n\t\"%~dp0\\..\\Prerequisites\\GnuWin32\\zip.exe\" -9 -r -z \"%~dp0\\out\\%OUT_NAME%.%%c.zip\" \"*.*\" < \"%PACK_PATH%\\BUILD_TAG\"\n\tpopd\n\tattrib +R \"%~dp0\\out\\%OUT_NAME%.%%c.zip\"\n)\n\nREM Clean up!\nrmdir /Q /S \"%PACK_PATH%\"\n\nREM ///////////////////////////////////////////////////////////////////////////\nREM // COMPLETE\nREM ///////////////////////////////////////////////////////////////////////////\necho.\necho Build completed.\necho.\npause\ngoto:eof\n\nREM ///////////////////////////////////////////////////////////////////////////\nREM // FAILED\nREM ///////////////////////////////////////////////////////////////////////////\n:BuildError\necho.\necho Build has failed ^^!^^!^^!\necho.\npause\n"
  },
  {
    "path": "z_test.bat",
    "content": "@echo off\n\nset \"WAV2PNG=D:\\Temp\\Downloads\\wav2png.exe\"\nset \"CONVERT=D:\\ImageMagick-6.9.0-Q16\\convert.exe\"\n\nrmdir /Q /S \"%~dp0\\tmp\" 2> NUL\nmkdir \"%~dp0\\tmp\"\n\ncall:runTest default\ncall:runTest dc-corr --correct-dc\ncall:runTest alt-bnd --alt-boundary\ncall:runTest dcc+alt --correct-dc --alt-boundary\ncall:runTest rms-val --target-rms 0.2\ncall:runTest dcc+rms --correct-dc --target-rms 0.2\n\ngoto:done\n\n:: ============================================================================\n\n:runTest\n\necho ###########################################################################\necho Test: %1\necho Args: %2 %3 %4 %5 %6 %7 %8 %9\necho ###########################################################################\n\nfor %%f in (%~dp0\\test\\*.wav) do (\n\techo.\n\techo ===========================================================================\n\techo %%~nxf\n\techo ===========================================================================\n\techo.\n\t\"%~dp0\\bin\\Win32\\Release_Static\\DynamicAudioNormalizerCLI.exe\" -i \"%%~f\" -o \"%~dp0\\tmp\\%%~nf.%1.wav\" -l \"%~dp0\\tmp\\%%~nf.%1.log\" %2 %3 %4 %5 %6 %7 %8 %9\n\t\"%WAV2PNG%\" --width 1920 -o \"%~dp0\\tmp\\~%%~nf.%1.A.png\" \"%%~f\"\n\t\"%WAV2PNG%\" --width 1920 -o \"%~dp0\\tmp\\~%%~nf.%1.B.png\" \"%~dp0\\tmp\\%%~nf.%1.wav\"\n\t\"%CONVERT%\" \"%~dp0\\tmp\\~%%~nf.%1.A.png\" \"%~dp0\\tmp\\~%%~nf.%1.B.png\" -append \"%~dp0\\tmp\\%%~nf.%1.png\"\n\tdel \"%~dp0\\tmp\\~%%~nf.%1.?.png\"\n)\n\necho.\necho.\n\nexit /b\n\n:: ============================================================================\n\n:done\n\necho Test Completed.\necho.\npause\n"
  }
]