Skip to content

Commit

Permalink
Fix compability issues
Browse files Browse the repository at this point in the history
  • Loading branch information
rzumer committed Nov 9, 2017
1 parent 5392b62 commit 556e297
Show file tree
Hide file tree
Showing 5 changed files with 181 additions and 11 deletions.
15 changes: 7 additions & 8 deletions BeatFinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

using namespace std;

BeatInfo FindBeats(char *inputFileName)
BeatInfo *FindBeats(const char *inputFileName)
{
const vector<AVCodecID> *codecIDs = new vector<AVCodecID>{ AV_CODEC_ID_PCM_F32BE, AV_CODEC_ID_PCM_F32LE };

Expand All @@ -23,10 +23,9 @@ BeatInfo FindBeats(char *inputFileName)
const double thresholdMultiplier = 1.5;

PCMDecoder *decoder = new PCMDecoder;
char *input = inputFileName;

const AVCodecID codecID = AV_CODEC_ID_PCM_U8;
AVPacket *packet = decoder->decodeAudio(input, codecID);
AVPacket *packet = decoder->decodeAudio(inputFileName, codecID);

int numSamples = 0;
int overflow = 0;
Expand Down Expand Up @@ -179,16 +178,16 @@ BeatInfo FindBeats(char *inputFileName)
ofstream stream2(strcat(input, "_peaks.txt"));
copy(peaks.begin(), peaks.end(), ostream_iterator<float>(stream2, "\n"));*/

BeatInfo beatInfo;
beatInfo.spectralFlux = spectralFlux;
beatInfo.peaks = peaks;
BeatInfo *beatInfo = new BeatInfo;
beatInfo->spectralFlux = spectralFlux;
beatInfo->peaks = peaks;

//cout << "Done." << endl;

return beatInfo;
}

int main(int argc, char* argv[])
/*int main(int argc, char* argv[])
{
if (argc >= 2)
{
Expand All @@ -207,4 +206,4 @@ int main(int argc, char* argv[])
getchar();
return 0;
}
}*/
7 changes: 6 additions & 1 deletion BeatFinder.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#pragma once

#ifndef BEATFINDER_H
#define BEATFINDER_H

#include <vector>

struct BeatInfo
Expand All @@ -9,4 +12,6 @@ struct BeatInfo
std::vector<int> peaks;
};

BeatInfo FindBeats(char *inputFileName);
BeatInfo *FindBeats(const char *inputFileName);

#endif
16 changes: 14 additions & 2 deletions BeatFinder.sln
Original file line number Diff line number Diff line change
@@ -1,26 +1,38 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.12
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BeatFinder", "BeatFinder.vcxproj", "{88A1C3F9-2740-4BC2-B601-FFF9AE318643}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Dynamic Release|x64 = Dynamic Release|x64
Dynamic Release|x86 = Dynamic Release|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
Static Release|x64 = Static Release|x64
Static Release|x86 = Static Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{88A1C3F9-2740-4BC2-B601-FFF9AE318643}.Debug|x64.ActiveCfg = Debug|x64
{88A1C3F9-2740-4BC2-B601-FFF9AE318643}.Debug|x64.Build.0 = Debug|x64
{88A1C3F9-2740-4BC2-B601-FFF9AE318643}.Debug|x86.ActiveCfg = Debug|Win32
{88A1C3F9-2740-4BC2-B601-FFF9AE318643}.Debug|x86.Build.0 = Debug|Win32
{88A1C3F9-2740-4BC2-B601-FFF9AE318643}.Dynamic Release|x64.ActiveCfg = Dynamic Release|x64
{88A1C3F9-2740-4BC2-B601-FFF9AE318643}.Dynamic Release|x64.Build.0 = Dynamic Release|x64
{88A1C3F9-2740-4BC2-B601-FFF9AE318643}.Dynamic Release|x86.ActiveCfg = Dynamic Release|Win32
{88A1C3F9-2740-4BC2-B601-FFF9AE318643}.Dynamic Release|x86.Build.0 = Dynamic Release|Win32
{88A1C3F9-2740-4BC2-B601-FFF9AE318643}.Release|x64.ActiveCfg = Release|x64
{88A1C3F9-2740-4BC2-B601-FFF9AE318643}.Release|x64.Build.0 = Release|x64
{88A1C3F9-2740-4BC2-B601-FFF9AE318643}.Release|x86.ActiveCfg = Release|Win32
{88A1C3F9-2740-4BC2-B601-FFF9AE318643}.Release|x86.Build.0 = Release|Win32
{88A1C3F9-2740-4BC2-B601-FFF9AE318643}.Static Release|x64.ActiveCfg = Static Release|x64
{88A1C3F9-2740-4BC2-B601-FFF9AE318643}.Static Release|x64.Build.0 = Static Release|x64
{88A1C3F9-2740-4BC2-B601-FFF9AE318643}.Static Release|x86.ActiveCfg = Static Release|Win32
{88A1C3F9-2740-4BC2-B601-FFF9AE318643}.Static Release|x86.Build.0 = Static Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
151 changes: 151 additions & 0 deletions BeatFinder.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Dynamic Release|Win32">
<Configuration>Dynamic Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Dynamic Release|x64">
<Configuration>Dynamic Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
Expand All @@ -17,6 +25,14 @@
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Static Release|Win32">
<Configuration>Static Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Static Release|x64">
<Configuration>Static Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
Expand All @@ -33,12 +49,26 @@
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Static Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Dynamic Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
Expand All @@ -52,6 +82,20 @@
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Static Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Dynamic Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand All @@ -63,12 +107,24 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Static Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Dynamic Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Static Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Dynamic Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
Expand All @@ -79,9 +135,21 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Static Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Dynamic Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Static Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Dynamic Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
Expand Down Expand Up @@ -126,6 +194,48 @@
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Static Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)\include;$(ProjectDir)dependencies\x86\ffmpeg\include;</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>$(ProjectDir)dependencies\x86\ffmpeg\lib;</AdditionalLibraryDirectories>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
<Lib>
<AdditionalDependencies>$(ProjectDir)dependencies/x86/ffmpeg/lib/avutil.lib;$(ProjectDir)dependencies/x86/ffmpeg/lib/avformat.lib;$(ProjectDir)dependencies/x86/ffmpeg/lib/avcodec.lib;$(ProjectDir)dependencies/x86/ffmpeg/lib/avfilter.lib</AdditionalDependencies>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Dynamic Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)\include;$(ProjectDir)dependencies\x86\ffmpeg\include;</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>$(ProjectDir)dependencies\x86\ffmpeg\lib;</AdditionalLibraryDirectories>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
Expand All @@ -143,11 +253,52 @@
<AdditionalLibraryDirectories>$(ProjectDir)dependencies\x64\ffmpeg\lib;</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Static Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)\include;$(ProjectDir)dependencies\x64\ffmpeg\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>$(ProjectDir)dependencies\x64\ffmpeg\lib;</AdditionalLibraryDirectories>
</Link>
<Lib>
<AdditionalDependencies>$(ProjectDir)dependencies/x64/ffmpeg/lib/avutil.lib;$(ProjectDir)dependencies/x64/ffmpeg/lib/avformat.lib;$(ProjectDir)dependencies/x64/ffmpeg/lib/avcodec.lib;$(ProjectDir)dependencies/x64/ffmpeg/lib/avfilter.lib</AdditionalDependencies>
</Lib>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Dynamic Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)\include;$(ProjectDir)dependencies\x64\ffmpeg\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>$(ProjectDir)dependencies\x64\ffmpeg\lib;</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="audioconv.h" />
<ClInclude Include="BeatFinder.h" />
<ClInclude Include="fileAudioDecoder.h" />
<ClInclude Include="fileAudioEncoder.h" />
<ClInclude Include="targetver.h" />
Expand Down
3 changes: 3 additions & 0 deletions BeatFinder.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
<ClInclude Include="fileAudioEncoder.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="BeatFinder.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="BeatFinder.cpp">
Expand Down

0 comments on commit 556e297

Please sign in to comment.