First Commit

This commit is contained in:
2025-02-06 22:24:29 +08:00
parent ed7df4c81e
commit 7539e6a53c
18116 changed files with 6181499 additions and 0 deletions

View File

@@ -0,0 +1,114 @@
////////////////////////////////////////////////////////////////////////////////
///
/// DllTest.cpp : This is small app main routine used for testing sound processing
/// with SoundTouch.dll API
///
/// Author : Copyright (c) Olli Parviainen
/// Author e-mail : oparviai 'at' iki.fi
/// SoundTouch WWW: http://www.surina.net/soundtouch
///
////////////////////////////////////////////////////////////////////////////////
#include <string>
#include <iostream>
#include <fstream>
#include "../SoundTouchDLL.h"
#include "../../SoundStretch/WavFile.h"
using namespace std;
// DllTest main
int main(int argc, char *argv[])
{
// Check program arguments
if (argc < 4)
{
cout << "Too few arguments. Usage: DllTest [infile.wav] [outfile.wav] [sampletype]" << endl;
return -1;
}
const char *inFileName = argv[1];
const char *outFileName = argv[2];
string str_sampleType = argv[3];
bool floatSample;
if (str_sampleType.compare("float") == 0)
{
floatSample = true;
}
else if (str_sampleType.compare("short") == 0)
{
floatSample = false;
}
else
{
cerr << "Missing or invalid sampletype '" << str_sampleType << "'. Expected either short or float" << endl;
return -1;
}
try
{
// Open input & output WAV files
WavInFile inFile(inFileName);
int numChannels = inFile.getNumChannels();
int sampleRate = inFile.getSampleRate();
WavOutFile outFile(outFileName, sampleRate, inFile.getNumBits(), numChannels);
// Create SoundTouch DLL instance
HANDLE st = soundtouch_createInstance();
soundtouch_setChannels(st, numChannels);
soundtouch_setSampleRate(st, sampleRate);
soundtouch_setPitchSemiTones(st, 2);
cout << "processing with soundtouch.dll routines";
if (floatSample)
{
// Process file with SoundTouch.DLL float sample (default) API
float fbuffer[2048];
int nmax = 2048 / numChannels;
cout << " using float api ..." << endl;
while (inFile.eof() == false)
{
int n = inFile.read(fbuffer, nmax * numChannels) / numChannels;
soundtouch_putSamples(st, fbuffer, n);
do
{
n = soundtouch_receiveSamples(st, fbuffer, nmax);
outFile.write(fbuffer, n * numChannels);
} while (n > 0);
}
}
else
{
// Process file with SoundTouch.DLL int16 (short) sample API.
// Notice that SoundTouch.dll does internally processing using floating
// point routines so the int16 API is not any faster, but provided for
// convenience.
short i16buffer[2048];
int nmax = 2048 / numChannels;
cout << " using i16 api ..." << endl;
while (inFile.eof() == false)
{
int n = inFile.read(i16buffer, nmax * numChannels) / numChannels;
soundtouch_putSamples_i16(st, i16buffer, n);
do
{
n = soundtouch_receiveSamples_i16(st, i16buffer, nmax);
outFile.write(i16buffer, n * numChannels);
} while (n > 0);
}
}
soundtouch_destroyInstance(st);
cout << "done." << endl;
}
catch (const runtime_error &e)
{
cerr << e.what() << endl;
}
return 0;
}

View File

@@ -0,0 +1,180 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{E3C0726F-28F4-4F0B-8183-B87CA60C063C}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>DllTest</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<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|Win32'">
<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>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)D</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(Platform)\$(Configuration)\</OutDir>
<TargetName>$(ProjectName)D_x64</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(Platform)\$(Configuration)\</OutDir>
<TargetName>$(ProjectName)_x64</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../include</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>..\..\..\lib\SoundTouchDllD.lib</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../include</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>..\..\..\lib\SoundTouchDllD_x64.lib</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../include</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>..\..\..\lib\SoundTouchDll.lib</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../include</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>..\..\..\lib\SoundTouchDll_x64.lib</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\SoundStretch\WavFile.cpp" />
<ClCompile Include="DllTest.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,10 @@
This is Lazarus Pascal example that loads the SoundTouch dynamic-load library
and queries the library version as a simple example how to load SoundTouch from
Pascal / Lazarus.
Set the SoundTouch dynamic library file name in the 'InitDLL' procedure of
file 'SoundTouchDLL.pas' depending on if you're building for Windows or Linux.
The example expects the the 'libSoundTouchDll.so' (linux) or 'SoundTouch.dll' (Windows)
library binary files is found within this project directory, either via soft-link
(in Linux) or as a copied file.

View File

@@ -0,0 +1,504 @@
unit SoundTouchDLL;
//////////////////////////////////////////////////////////////////////////////
//
// SoundTouch.dll / libSoundTouchDll.so wrapper for accessing SoundTouch
// routines from Delphi/Pascal/Lazarus
//
////////////////////////////////////////////////////////////////////////////////
//
// License :
//
// SoundTouch audio processing library
// Copyright (c) Olli Parviainen
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////
interface
//uses
//Windows;
type
TSoundTouchHandle = THandle;
// Create a new instance of SoundTouch processor.
TSoundTouchCreateInstance = function : TSoundTouchHandle; cdecl;
// Destroys a SoundTouch processor instance.
TSoundTouchDestroyInstance = procedure (Handle: TSoundTouchHandle); cdecl;
// Get SoundTouch library version string
TSoundTouchGetVersionString = function : PAnsiChar; cdecl;
// Get SoundTouch library version string 2
TSoundTouchGetVersionString2 = procedure(VersionString : PAnsiChar; BufferSize : Integer); cdecl;
// Get SoundTouch library version Id
TSoundTouchGetVersionId = function : Cardinal; cdecl;
// Sets new rate control value. Normal rate = 1.0, smaller values
// represent slower rate, larger faster rates.
TSoundTouchSetRate = procedure (Handle: TSoundTouchHandle; NewRate: Single); cdecl;
// Sets new tempo control value. Normal tempo = 1.0, smaller values
// represent slower tempo, larger faster tempo.
TSoundTouchSetTempo = procedure (Handle: TSoundTouchHandle; NewTempo: Single); cdecl;
// Sets new rate control value as a difference in percents compared
// to the original rate (-50 .. +100 %);
TSoundTouchSetRateChange = procedure (Handle: TSoundTouchHandle; NewRate: Single); cdecl;
// Sets new tempo control value as a difference in percents compared
// to the original tempo (-50 .. +100 %);
TSoundTouchSetTempoChange = procedure (Handle: TSoundTouchHandle; NewTempo: Single); cdecl;
// Sets new pitch control value. Original pitch = 1.0, smaller values
// represent lower pitches, larger values higher pitch.
TSoundTouchSetPitch = procedure (Handle: TSoundTouchHandle; NewPitch: Single); cdecl;
// Sets pitch change in octaves compared to the original pitch
// (-1.00 .. +1.00);
TSoundTouchSetPitchOctaves = procedure (Handle: TSoundTouchHandle; NewPitch: Single); cdecl;
// Sets pitch change in semi-tones compared to the original pitch
// (-12 .. +12);
TSoundTouchSetPitchSemiTones = procedure (Handle: TSoundTouchHandle; NewPitch: Single); cdecl;
// Sets the number of channels, 1 = mono, 2 = stereo
TSoundTouchSetChannels = procedure (Handle: TSoundTouchHandle; NumChannels: Cardinal); cdecl;
// Sets sample rate.
TSoundTouchSetSampleRate = procedure (Handle: TSoundTouchHandle; SampleRate: Cardinal); cdecl;
// Flushes the last samples from the processing pipeline to the output.
// Clears also the internal processing buffers.
//
// Note: This function is meant for extracting the last samples of a sound
// stream. This function may introduce additional blank samples in the end
// of the sound stream, and thus it
// in the middle of a sound stream.
TSoundTouchFlush = procedure (Handle: TSoundTouchHandle); cdecl;
// Adds 'numSamples' pcs of samples from the 'samples' memory position into
// the input of the object. Notice that sample rate _has_to_ be set before
// calling this function, otherwise throws a runtime_error exception.
TSoundTouchPutSamples = procedure (Handle: TSoundTouchHandle;
const Samples: PSingle; //< Pointer to sample buffer.
NumSamples: Cardinal //< Number of samples in buffer. Notice
//< that in case of stereo-sound a single sample
//< contains data for both channels.
); cdecl;
TSoundTouchPutSamplesI16 = procedure (Handle: TSoundTouchHandle;
const Samples: Pint16; //< Pointer to sample buffer.
NumSamples: Cardinal //< Number of samples in buffer. Notice
//< that in case of stereo-sound a single sample
//< contains data for both channels.
); cdecl;
// Clears all the samples in the object's output and internal processing
// buffers.
TSoundTouchClear = procedure (Handle: TSoundTouchHandle); cdecl;
// Changes a setting controlling the processing system behaviour. See the
// 'SETTING_...' defines for available setting ID's.
//
// \return 'TRUE' if the setting was successfully changed
TSoundTouchSetSetting = function (Handle: TSoundTouchHandle;
SettingId: Integer; //< Setting ID number. see SETTING_... defines.
Value: Integer //< New setting value.
): Boolean; cdecl;
// Reads a setting controlling the processing system behaviour. See the
// 'SETTING_...' defines for available setting ID's.
//
// \return the setting value.
TSoundTouchGetSetting = function (Handle: TSoundTouchHandle;
SettingId: Integer //< Setting ID number, see SETTING_... defines.
): Integer; cdecl;
// Returns number of samples currently unprocessed.
TSoundTouchNumUnprocessedSamples = function (Handle: TSoundTouchHandle): Cardinal; cdecl;
/// Receive ready samples from the processing pipeline.
///
/// if called with outBuffer=nullptr, just reduces amount of ready samples within the pipeline.
TSoundTouchReceiveSamples = function (Handle: TSoundTouchHandle;
OutBuffer: PSingle; //< Buffer where to copy output samples.
MaxSamples: Integer //< How many samples to receive at max.
): Cardinal; cdecl;
/// int16 version of soundtouch_receiveSamples(): This converts internal float samples
/// into int16 (short) return data type
TSoundTouchReceiveSamplesI16 = function (Handle: TSoundTouchHandle;
OutBuffer: int16; //< Buffer where to copy output samples.
MaxSamples: Integer //< How many samples to receive at max.
): Cardinal; cdecl;
// Returns number of samples currently available.
TSoundTouchNumSamples = function (Handle: TSoundTouchHandle): Cardinal; cdecl;
// Returns nonzero if there aren't any samples available for outputting.
TSoundTouchIsEmpty = function (Handle: TSoundTouchHandle): Integer; cdecl;
var
SoundTouchCreateInstance : TSoundTouchCreateInstance;
SoundTouchDestroyInstance : TSoundTouchDestroyInstance;
SoundTouchGetVersionString : TSoundTouchGetVersionString;
SoundTouchGetVersionString2 : TSoundTouchGetVersionString2;
SoundTouchGetVersionId : TSoundTouchGetVersionId;
SoundTouchSetRate : TSoundTouchSetRate;
SoundTouchSetTempo : TSoundTouchSetTempo;
SoundTouchSetRateChange : TSoundTouchSetRateChange;
SoundTouchSetTempoChange : TSoundTouchSetTempoChange;
SoundTouchSetPitch : TSoundTouchSetPitch;
SoundTouchSetPitchOctaves : TSoundTouchSetPitchOctaves;
SoundTouchSetPitchSemiTones : TSoundTouchSetPitchSemiTones;
SoundTouchSetChannels : TSoundTouchSetChannels;
SoundTouchSetSampleRate : TSoundTouchSetSampleRate;
SoundTouchFlush : TSoundTouchFlush;
SoundTouchPutSamples : TSoundTouchPutSamples;
SoundTouchPutSamplesI16 : TSoundTouchPutSamplesI16;
SoundTouchClear : TSoundTouchClear;
SoundTouchSetSetting : TSoundTouchSetSetting;
SoundTouchGetSetting : TSoundTouchGetSetting;
SoundTouchNumUnprocessedSamples : TSoundTouchNumUnprocessedSamples;
SoundTouchReceiveSamples : TSoundTouchReceiveSamples;
SoundTouchReceiveSamplesI16 : TSoundTouchReceiveSamplesI16;
SoundTouchNumSamples : TSoundTouchNumSamples;
SoundTouchIsEmpty : TSoundTouchIsEmpty;
type
TSoundTouch = class
private
FHandle : TSoundTouchHandle;
FRate : Single;
FPitch : Single;
FTempo : Single;
FSampleRate : Single;
FChannels : Cardinal;
function GetNumSamples: Cardinal;
function GetNumUnprocessedSamples: Cardinal;
function GetIsEmpty: Integer;
function GetPitchChange: Single;
function GetRateChange: Single;
function GetTempoChange: Single;
procedure SetRate(const Value: Single);
procedure SetPitch(const Value: Single);
procedure SetTempo(const Value: Single);
procedure SetPitchChange(const Value: Single);
procedure SetRateChange(const Value: Single);
procedure SetTempoChange(const Value: Single);
procedure SetChannels(const Value: Cardinal);
procedure SetSampleRate(const Value: Single);
protected
procedure SamplerateChanged; virtual;
procedure ChannelsChanged; virtual;
procedure PitchChanged; virtual;
procedure TempoChanged; virtual;
procedure RateChanged; virtual;
public
class function GetVersionString: string;
class function GetVersionId: Cardinal;
constructor Create; virtual;
destructor Destroy; override;
procedure Flush; virtual;
procedure Clear; virtual;
procedure PutSamples(const Samples: PSingle; const NumSamples: Cardinal);
function ReceiveSamples(const OutBuffer: PSingle; const MaxSamples: Integer): Cardinal;
function SetSetting(const SettingId: Integer; const Value: Integer): Boolean;
function GetSetting(const SettingId: Integer): Integer;
property VersionString: string read GetVersionString;
property VersionID: Cardinal read GetVersionId;
property Channels: Cardinal read FChannels write SetChannels;
property Rate: Single read FRate write SetRate;
property RateChange: Single read GetRateChange write SetRateChange;
property Tempo: Single read FTempo write SetTempo;
property TempoChange: Single read GetTempoChange write SetTempoChange;
property Pitch: Single read FPitch write SetPitch;
property PitchChange: Single read GetPitchChange write SetPitchChange;
property SampleRate: Single read FSampleRate write SetSampleRate;
property NumSamples: Cardinal read GetNumSamples;
property NumUnprocessedSamples: Cardinal read GetNumUnprocessedSamples;
property IsEmpty: Integer read GetIsEmpty;
end;
// list of exported functions and procedures
function IsSoundTouchLoaded: Boolean;
implementation
{ TSoundTouch }
constructor TSoundTouch.Create;
begin
inherited;
FHandle := SoundTouchCreateInstance();
FRate := 1;
FTempo := 1;
FPitch := 1;
FChannels := 1;
FSampleRate := 44100;
SamplerateChanged;
ChannelsChanged;
end;
destructor TSoundTouch.Destroy;
begin
SoundTouchDestroyInstance(FHandle);
inherited;
end;
procedure TSoundTouch.Flush;
begin
SoundTouchFlush(FHandle);
end;
procedure TSoundTouch.Clear;
begin
SoundTouchClear(FHandle);
end;
function TSoundTouch.GetIsEmpty: Integer;
begin
result := SoundTouchIsEmpty(FHandle);
end;
function TSoundTouch.GetNumSamples: Cardinal;
begin
result := SoundTouchNumSamples(FHandle);
end;
function TSoundTouch.GetNumUnprocessedSamples: Cardinal;
begin
result := SoundTouchNumUnprocessedSamples(FHandle);
end;
function TSoundTouch.GetPitchChange: Single;
begin
result := 100 * (FPitch - 1.0);
end;
function TSoundTouch.GetRateChange: Single;
begin
result := 100 * (FRate - 1.0);
end;
function TSoundTouch.GetTempoChange: Single;
begin
result := 100 * (FTempo - 1.0);
end;
class function TSoundTouch.GetVersionId: Cardinal;
begin
result := SoundTouchGetVersionId();
end;
class function TSoundTouch.GetVersionString: string;
begin
result := StrPas(SoundTouchGetVersionString());
end;
procedure TSoundTouch.SetChannels(const Value: Cardinal);
begin
if FChannels <> Value then
begin
FChannels := Value;
ChannelsChanged;
end;
end;
procedure TSoundTouch.ChannelsChanged;
begin
assert(FChannels in [1, 2]);
SoundTouchSetChannels(FHandle, FChannels);
end;
procedure TSoundTouch.SetPitch(const Value: Single);
begin
if FPitch <> Value then
begin
FPitch := Value;
PitchChanged;
end;
end;
procedure TSoundTouch.PitchChanged;
begin
SoundTouchSetPitch(FHandle, FPitch);
end;
procedure TSoundTouch.putSamples(const Samples: PSingle;
const NumSamples: Cardinal);
begin
SoundTouchPutSamples(FHandle, Samples, NumSamples);
end;
procedure TSoundTouch.RateChanged;
begin
SoundTouchSetRate(FHandle, FRate);
end;
function TSoundTouch.ReceiveSamples(const OutBuffer: PSingle;
const MaxSamples: Integer): Cardinal;
begin
result := SoundTouchReceiveSamples(FHandle, OutBuffer, MaxSamples);
end;
procedure TSoundTouch.SetPitchChange(const Value: Single);
begin
Pitch := 1.0 + 0.01 * Value;
end;
procedure TSoundTouch.SetRate(const Value: Single);
begin
if FRate <> Value then
begin
FRate := Value;
RateChanged;
end;
end;
procedure TSoundTouch.SetRateChange(const Value: Single);
begin
Rate := 1.0 + 0.01 * Value;
end;
procedure TSoundTouch.SetSampleRate(const Value: Single);
begin
if FSampleRate <> Value then
begin
FSampleRate := Value;
SamplerateChanged;
end;
end;
procedure TSoundTouch.SamplerateChanged;
begin
assert(FSampleRate > 0);
SoundTouchsetSampleRate(FHandle, round(FSampleRate));
end;
procedure TSoundTouch.SetTempo(const Value: Single);
begin
if FTempo <> Value then
begin
FTempo := Value;
TempoChanged;
end;
end;
procedure TSoundTouch.SetTempoChange(const Value: Single);
begin
Tempo := 1.0 + 0.01 * Value;
end;
function TSoundTouch.GetSetting(const SettingId: Integer): Integer;
begin
result := SoundTouchGetSetting(FHandle, SettingId);
end;
function TSoundTouch.SetSetting(const SettingId: Integer;
const Value: Integer): Boolean;
begin
result := SoundTouchSetSetting(FHandle, SettingId, Value);
end;
procedure TSoundTouch.TempoChanged;
begin
SoundTouchsetTempo(FHandle, FTempo);
end;
var
SoundTouchLibHandle: THandle;
SoundTouchDLLFile: AnsiString = 'libSoundTouchDll.so';
//SoundTouchDLLFile: AnsiString = 'SoundTouch.dll';
// bpm detect functions. untested -- if these don't work then remove:
bpm_createInstance: function(chan: int32; sampleRate : int32): THandle; cdecl;
bpm_destroyInstance: procedure(h: THandle); cdecl;
bpm_getBpm: function(h: THandle): Single; cdecl;
bpm_putSamples: procedure(h: THandle; const samples: PSingle; numSamples: cardinal); cdecl;
procedure InitDLL;
begin
{$ifdef mswindows} // Windows
SoundTouchLibHandle := LoadLibrary('.\SoundTouchDll.dll');
{$else} // Unix
SoundTouchLibHandle := LoadLibrary('./libSoundTouchDll.so');
{$endif}
if SoundTouchLibHandle <> 0 then
try
Pointer(SoundTouchCreateInstance) := GetProcAddress(SoundTouchLibHandle, 'soundtouch_createInstance');
Pointer(SoundTouchDestroyInstance) := GetProcAddress(SoundTouchLibHandle, 'soundtouch_destroyInstance');
Pointer(SoundTouchGetVersionString) := GetProcAddress(SoundTouchLibHandle, 'soundtouch_getVersionString');
Pointer(SoundTouchGetVersionString2) := GetProcAddress(SoundTouchLibHandle, 'soundtouch_getVersionString2');
Pointer(SoundTouchGetVersionId) := GetProcAddress(SoundTouchLibHandle, 'soundtouch_getVersionId');
Pointer(SoundTouchSetRate) := GetProcAddress(SoundTouchLibHandle, 'soundtouch_setRate');
Pointer(SoundTouchSetTempo) := GetProcAddress(SoundTouchLibHandle, 'soundtouch_setTempo');
Pointer(SoundTouchSetRateChange) := GetProcAddress(SoundTouchLibHandle, 'soundtouch_setRateChange');
Pointer(SoundTouchSetTempoChange) := GetProcAddress(SoundTouchLibHandle, 'soundtouch_setTempoChange');
Pointer(SoundTouchSetPitch) := GetProcAddress(SoundTouchLibHandle, 'soundtouch_setPitch');
Pointer(SoundTouchSetPitchOctaves) := GetProcAddress(SoundTouchLibHandle, 'soundtouch_setPitchOctaves');
Pointer(SoundTouchSetPitchSemiTones) := GetProcAddress(SoundTouchLibHandle, 'soundtouch_setPitchSemiTones');
Pointer(SoundTouchSetChannels) := GetProcAddress(SoundTouchLibHandle, 'soundtouch_setChannels');
Pointer(SoundTouchSetSampleRate) := GetProcAddress(SoundTouchLibHandle, 'soundtouch_setSampleRate');
Pointer(SoundTouchFlush) := GetProcAddress(SoundTouchLibHandle, 'soundtouch_flush');
Pointer(SoundTouchPutSamples) := GetProcAddress(SoundTouchLibHandle, 'soundtouch_putSamples');
Pointer(SoundTouchPutSamplesI16) := GetProcAddress(SoundTouchLibHandle, 'soundtouch_putSamples_i16');
Pointer(SoundTouchClear) := GetProcAddress(SoundTouchLibHandle, 'soundtouch_clear');
Pointer(SoundTouchSetSetting) := GetProcAddress(SoundTouchLibHandle, 'soundtouch_SetSetting');
Pointer(SoundTouchGetSetting) := GetProcAddress(SoundTouchLibHandle, 'soundtouch_setSetting');
Pointer(SoundTouchNumUnprocessedSamples) := GetProcAddress(SoundTouchLibHandle, 'soundtouch_numUnprocessedSamples');
Pointer(SoundTouchReceiveSamples) := GetProcAddress(SoundTouchLibHandle, 'soundtouch_receiveSamples');
Pointer(SoundTouchReceiveSamplesI16) := GetProcAddress(SoundTouchLibHandle, 'soundtouch_receiveSamples_i16');
Pointer(SoundTouchNumSamples) := GetProcAddress(SoundTouchLibHandle, 'soundtouch_numSamples');
Pointer(SoundTouchIsEmpty) := GetProcAddress(SoundTouchLibHandle, 'soundtouch_isEmpty');
Pointer(bpm_createInstance) :=GetProcAddress(SoundTouchLibHandle, 'bpm_createInstance');
Pointer(bpm_destroyInstance) :=GetProcAddress(SoundTouchLibHandle, 'bpm_destroyInstance');
Pointer(bpm_getBpm) :=GetProcAddress(SoundTouchLibHandle, 'bpm_getBpm');
Pointer(bpm_putSamples) :=GetProcAddress(SoundTouchLibHandle, 'bpm_putSamples');
except
FreeLibrary(SoundTouchLibHandle);
SoundTouchLibHandle := 0;
end;
end;
procedure FreeDLL;
begin
if SoundTouchLibHandle <> 0 then FreeLibrary(SoundTouchLibHandle);
end;
// returns 'true' if SoundTouch dynamic library has been successfully loaded, otherwise 'false'
function IsSoundTouchLoaded: Boolean;
begin;
result := SoundTouchLibHandle <> 0
end;
initialization
InitDLL;
finalization
FreeDLL;
end.

View File

@@ -0,0 +1,36 @@
object Form1: TForm1
Left = 2237
Height = 128
Top = 242
Width = 381
Caption = 'SoundTouch test'
ClientHeight = 128
ClientWidth = 381
LCLVersion = '2.2.0.4'
object Load: TButton
Left = 19
Height = 50
Top = 16
Width = 144
Caption = 'Load SoundTouch'
OnClick = LoadClick
TabOrder = 0
end
object EditVersion: TEdit
Left = 184
Height = 34
Top = 80
Width = 184
TabOrder = 1
Text = 'n/a'
TextHint = 'click to populate'
end
object Label1: TLabel
Left = 19
Height = 17
Top = 90
Width = 156
Caption = 'Soundtouch lib version:'
WordWrap = True
end
end

View File

@@ -0,0 +1,49 @@
unit main;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, SoundTouchDLL;
type
{ TForm1 }
TForm1 = class(TForm)
EditVersion: TEdit;
Label1: TLabel;
Load: TButton;
procedure LoadClick(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.LoadClick(Sender: TObject);
var
version:string;
begin
if IsSoundTouchLoaded() then
version := SoundTouchGetVersionString()
else
version := '<library loading failed>';
EditVersion.Text:= version;
end;
end.

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

View File

@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="12"/>
<General>
<SessionStorage Value="InProjectDir"/>
<Title Value="soundtouchtest"/>
<Scaled Value="True"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<XPManifest>
<DpiAware Value="True"/>
</XPManifest>
<Icon Value="0"/>
</General>
<BuildModes>
<Item Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<UseFileFilters Value="True"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
</RunParams>
<RequiredPackages>
<Item>
<PackageName Value="LCL"/>
</Item>
</RequiredPackages>
<Units>
<Unit>
<Filename Value="soundtouchtest.lpr"/>
<IsPartOfProject Value="True"/>
</Unit>
<Unit>
<Filename Value="main.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="soundtouchtest"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf3"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions>
<Item>
<Name Value="EAbort"/>
</Item>
<Item>
<Name Value="ECodetoolError"/>
</Item>
<Item>
<Name Value="EFOpenError"/>
</Item>
</Exceptions>
</Debugging>
</CONFIG>

View File

@@ -0,0 +1,25 @@
program soundtouchtest;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
{$IFDEF HASAMIGA}
athreads,
{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, main
{ you can add units after this };
{$R *.res}
begin
RequireDerivedFormResource:=True;
Application.Scaled:=True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@@ -0,0 +1,186 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectSession>
<Version Value="12"/>
<BuildModes Active="Default"/>
<Units>
<Unit>
<Filename Value="soundtouchtest.lpr"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/>
<WindowIndex Value="-1"/>
<TopLine Value="-1"/>
<CursorPos X="-1" Y="-1"/>
<UsageCount Value="21"/>
</Unit>
<Unit>
<Filename Value="main.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<IsVisibleTab Value="True"/>
<CursorPos X="26" Y="43"/>
<UsageCount Value="21"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit>
<Unit>
<Filename Value="../SoundTouchDLL.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="37"/>
<CursorPos X="19"/>
<UsageCount Value="10"/>
</Unit>
<Unit>
<Filename Value="/usr/lib/lazarus/2.2.0/lcl/interfaces/gtk2/gtk2proc.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="7149"/>
<CursorPos X="3" Y="7184"/>
<UsageCount Value="10"/>
</Unit>
<Unit>
<Filename Value="/usr/lib/lazarus/2.2.0/components/freetype/easylazfreetype.pas"/>
<UnitName Value="EasyLazFreeType"/>
<EditorIndex Value="-1"/>
<TopLine Value="539"/>
<CursorPos X="16" Y="574"/>
<UsageCount Value="10"/>
</Unit>
<Unit>
<Filename Value="SoundTouchDLL.pas"/>
<EditorIndex Value="1"/>
<TopLine Value="326"/>
<CursorPos X="127" Y="379"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit>
</Units>
<JumpHistory HistoryIndex="29">
<Position>
<Filename Value="SoundTouchDLL.pas"/>
<Caret Line="439" TopLine="403"/>
</Position>
<Position>
<Filename Value="SoundTouchDLL.pas"/>
<Caret Line="427" Column="37" TopLine="403"/>
</Position>
<Position>
<Filename Value="SoundTouchDLL.pas"/>
<Caret Line="439" TopLine="403"/>
</Position>
<Position>
<Filename Value="SoundTouchDLL.pas"/>
<Caret Line="427" Column="32" TopLine="403"/>
</Position>
<Position>
<Filename Value="SoundTouchDLL.pas"/>
<Caret Line="444" Column="48" TopLine="403"/>
</Position>
<Position>
<Filename Value="SoundTouchDLL.pas"/>
<Caret Line="439" TopLine="403"/>
</Position>
<Position>
<Filename Value="SoundTouchDLL.pas"/>
<Caret Line="416" Column="116" TopLine="403"/>
</Position>
<Position>
<Filename Value="SoundTouchDLL.pas"/>
<Caret Line="439" TopLine="403"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="45" Column="40"/>
</Position>
<Position>
<Filename Value="SoundTouchDLL.pas"/>
<Caret Line="243" Column="38" TopLine="197"/>
</Position>
<Position>
<Filename Value="SoundTouchDLL.pas"/>
<Caret Line="487" Column="38" TopLine="429"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="42" Column="8"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="41" Column="44"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="44" Column="6"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="43" Column="39"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="44" Column="7"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="38" Column="7"/>
</Position>
<Position>
<Filename Value="SoundTouchDLL.pas"/>
<Caret Line="467" TopLine="423"/>
</Position>
<Position>
<Filename Value="SoundTouchDLL.pas"/>
<Caret Line="212" Column="32" TopLine="78"/>
</Position>
<Position>
<Filename Value="SoundTouchDLL.pas"/>
<Caret Line="361" Column="37" TopLine="308"/>
</Position>
<Position>
<Filename Value="SoundTouchDLL.pas"/>
<Caret Line="466" Column="37" TopLine="413"/>
</Position>
<Position>
<Filename Value="SoundTouchDLL.pas"/>
<Caret Line="467" Column="37" TopLine="413"/>
</Position>
<Position>
<Filename Value="SoundTouchDLL.pas"/>
<Caret Line="466" Column="13" TopLine="413"/>
</Position>
<Position>
<Filename Value="SoundTouchDLL.pas"/>
<Caret Line="361" Column="13" TopLine="326"/>
</Position>
<Position>
<Filename Value="SoundTouchDLL.pas"/>
<Caret Line="110" Column="3" TopLine="74"/>
</Position>
<Position>
<Filename Value="SoundTouchDLL.pas"/>
<Caret Line="180" Column="37" TopLine="145"/>
</Position>
<Position>
<Filename Value="SoundTouchDLL.pas"/>
<Caret Line="179" Column="55" TopLine="145"/>
</Position>
<Position>
<Filename Value="SoundTouchDLL.pas"/>
<Caret Line="146" Column="3" TopLine="145"/>
</Position>
<Position>
<Filename Value="SoundTouchDLL.pas"/>
<Caret Line="149" TopLine="111"/>
</Position>
<Position>
<Filename Value="SoundTouchDLL.pas"/>
<Caret Line="151" Column="31" TopLine="116"/>
</Position>
</JumpHistory>
<RunParams>
<FormatVersion Value="2"/>
<Modes ActiveMode=""/>
</RunParams>
</ProjectSession>
</CONFIG>

View File

@@ -0,0 +1,47 @@
## Process this file with automake to create Makefile.in
##
## This file is part of SoundTouch, an audio processing library for pitch/time adjustments
##
## SoundTouch is free software; you can redistribute it and/or modify it under the
## terms of the GNU General Public License as published by the Free Software
## Foundation; either version 2 of the License, or (at your option) any later
## version.
##
## SoundTouch is distributed in the hope that it will be useful, but WITHOUT ANY
## WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
## A PARTICULAR PURPOSE. See the GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License along with
## this program; if not, write to the Free Software Foundation, Inc., 59 Temple
## Place - Suite 330, Boston, MA 02111-1307, USA
include $(top_srcdir)/config/am_include.mk
noinst_HEADERS=../SoundTouch/AAFilter.h ../SoundTouch/cpu_detect.h ../SoundTouch/cpu_detect_x86.cpp ../SoundTouch/FIRFilter.h \
../SoundTouch/RateTransposer.h ../SoundTouch/TDStretch.h ../SoundTouch/PeakFinder.h ../SoundTouch/InterpolateCubic.h \
../SoundTouch/InterpolateLinear.h ../SoundTouch/InterpolateShannon.h
include_HEADERS=SoundTouchDLL.h
lib_LTLIBRARIES=libSoundTouchDll.la
#
libSoundTouchDll_la_SOURCES=../SoundTouch/AAFilter.cpp ../SoundTouch/FIRFilter.cpp \
../SoundTouch/FIFOSampleBuffer.cpp ../SoundTouch/RateTransposer.cpp ../SoundTouch/SoundTouch.cpp \
../SoundTouch/TDStretch.cpp ../SoundTouch/sse_optimized.cpp ../SoundTouch/cpu_detect_x86.cpp \
../SoundTouch/BPMDetect.cpp ../SoundTouch/PeakFinder.cpp ../SoundTouch/InterpolateLinear.cpp \
../SoundTouch/InterpolateCubic.cpp ../SoundTouch/InterpolateShannon.cpp SoundTouchDLL.cpp
# Compiler flags
# Modify the default 0.0.0 to LIB_SONAME.0.0
LDFLAGS=-version-info @LIB_SONAME@
if X86
CXXFLAGS1=-mstackrealign -msse
endif
if X86_64
CXXFLAGS2=-fPIC
endif
CXXFLAGS+=$(AM_CXXFLAGS) $(CXXFLAGS1) $(CXXFLAGS2) -shared -DDLL_EXPORTS -fvisibility=hidden

View File

@@ -0,0 +1,582 @@
//////////////////////////////////////////////////////////////////////////////
///
/// SoundTouch DLL wrapper - wraps SoundTouch routines into a Dynamic Load
/// Library interface.
///
/// Author : Copyright (c) Olli Parviainen
/// Author e-mail : oparviai 'at' iki.fi
/// SoundTouch WWW: http://www.surina.net/soundtouch
///
////////////////////////////////////////////////////////////////////////////////
//
// License :
//
// SoundTouch audio processing library
// Copyright (c) Olli Parviainen
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////
#if defined(_WIN32) || defined(WIN32)
#include <windows.h>
// DLL main in Windows compilation
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
#endif
#include <limits.h>
#include <string.h>
#include "SoundTouchDLL.h"
#include "SoundTouch.h"
#include "BPMDetect.h"
using namespace soundtouch;
#ifdef SOUNDTOUCH_INTEGER_SAMPLES
#error "error - compile the dll version with float samples"
#endif // SOUNDTOUCH_INTEGER_SAMPLES
//////////////
typedef struct
{
DWORD dwMagic;
SoundTouch *pst;
} STHANDLE;
typedef struct
{
DWORD dwMagic;
BPMDetect *pbpm;
uint numChannels;
} BPMHANDLE;
#define STMAGIC 0x1770C001
#define BPMMAGIC 0x1771C10a
SOUNDTOUCHDLL_API HANDLE __cdecl soundtouch_createInstance()
{
STHANDLE *tmp = new STHANDLE;
if (tmp)
{
tmp->dwMagic = STMAGIC;
tmp->pst = new SoundTouch();
if (tmp->pst == nullptr)
{
delete tmp;
tmp = nullptr;
}
}
return (HANDLE)tmp;
}
SOUNDTOUCHDLL_API void __cdecl soundtouch_destroyInstance(HANDLE h)
{
STHANDLE *sth = (STHANDLE*)h;
if (sth->dwMagic != STMAGIC) return;
sth->dwMagic = 0;
if (sth->pst) delete sth->pst;
sth->pst = nullptr;
delete sth;
}
/// Get SoundTouch library version string
SOUNDTOUCHDLL_API const char *__cdecl soundtouch_getVersionString()
{
return SoundTouch::getVersionString();
}
/// Get SoundTouch library version string - alternative function for
/// environments that can't properly handle character string as return value
SOUNDTOUCHDLL_API void __cdecl soundtouch_getVersionString2(char* versionString, int bufferSize)
{
strncpy(versionString, SoundTouch::getVersionString(), bufferSize - 1);
versionString[bufferSize - 1] = 0;
}
/// Get SoundTouch library version Id
SOUNDTOUCHDLL_API uint __cdecl soundtouch_getVersionId()
{
return SoundTouch::getVersionId();
}
/// Sets new rate control value. Normal rate = 1.0, smaller values
/// represent slower rate, larger faster rates.
SOUNDTOUCHDLL_API void __cdecl soundtouch_setRate(HANDLE h, float newRate)
{
STHANDLE *sth = (STHANDLE*)h;
if (sth->dwMagic != STMAGIC) return;
sth->pst->setRate(newRate);
}
/// Sets new tempo control value. Normal tempo = 1.0, smaller values
/// represent slower tempo, larger faster tempo.
SOUNDTOUCHDLL_API void __cdecl soundtouch_setTempo(HANDLE h, float newTempo)
{
STHANDLE *sth = (STHANDLE*)h;
if (sth->dwMagic != STMAGIC) return;
sth->pst->setTempo(newTempo);
}
/// Sets new rate control value as a difference in percents compared
/// to the original rate (-50 .. +100 %)
SOUNDTOUCHDLL_API void __cdecl soundtouch_setRateChange(HANDLE h, float newRate)
{
STHANDLE *sth = (STHANDLE*)h;
if (sth->dwMagic != STMAGIC) return;
sth->pst->setRateChange(newRate);
}
/// Sets new tempo control value as a difference in percents compared
/// to the original tempo (-50 .. +100 %)
SOUNDTOUCHDLL_API void __cdecl soundtouch_setTempoChange(HANDLE h, float newTempo)
{
STHANDLE *sth = (STHANDLE*)h;
if (sth->dwMagic != STMAGIC) return;
sth->pst->setTempoChange(newTempo);
}
/// Sets new pitch control value. Original pitch = 1.0, smaller values
/// represent lower pitches, larger values higher pitch.
SOUNDTOUCHDLL_API void __cdecl soundtouch_setPitch(HANDLE h, float newPitch)
{
STHANDLE *sth = (STHANDLE*)h;
if (sth->dwMagic != STMAGIC) return;
sth->pst->setPitch(newPitch);
}
/// Sets pitch change in octaves compared to the original pitch
/// (-1.00 .. +1.00)
SOUNDTOUCHDLL_API void __cdecl soundtouch_setPitchOctaves(HANDLE h, float newPitch)
{
STHANDLE *sth = (STHANDLE*)h;
if (sth->dwMagic != STMAGIC) return;
sth->pst->setPitchOctaves(newPitch);
}
/// Sets pitch change in semi-tones compared to the original pitch
/// (-12 .. +12)
SOUNDTOUCHDLL_API void __cdecl soundtouch_setPitchSemiTones(HANDLE h, float newPitch)
{
STHANDLE *sth = (STHANDLE*)h;
if (sth->dwMagic != STMAGIC) return;
sth->pst->setPitchSemiTones(newPitch);
}
/// Sets the number of channels, 1 = mono, 2 = stereo
SOUNDTOUCHDLL_API int __cdecl soundtouch_setChannels(HANDLE h, uint numChannels)
{
STHANDLE *sth = (STHANDLE*)h;
if (sth->dwMagic != STMAGIC) return 0;
try
{
sth->pst->setChannels(numChannels);
}
catch (const std::exception&)
{
return 0;
}
return 1;
}
/// Sets sample rate.
SOUNDTOUCHDLL_API int __cdecl soundtouch_setSampleRate(HANDLE h, uint srate)
{
STHANDLE *sth = (STHANDLE*)h;
if (sth->dwMagic != STMAGIC) return 0;
try
{
sth->pst->setSampleRate(srate);
}
catch (const std::exception&)
{
return 0;
}
return 1;
}
/// Flushes the last samples from the processing pipeline to the output.
/// Clears also the internal processing buffers.
//
/// Note: This function is meant for extracting the last samples of a sound
/// stream. This function may introduce additional blank samples in the end
/// of the sound stream, and thus it's not recommended to call this function
/// in the middle of a sound stream.
SOUNDTOUCHDLL_API int __cdecl soundtouch_flush(HANDLE h)
{
STHANDLE *sth = (STHANDLE*)h;
if (sth->dwMagic != STMAGIC) return 0;
try
{
sth->pst->flush();
}
catch (const std::exception&)
{
return 0;
}
return 1;
}
/// Adds 'numSamples' pcs of samples from the 'samples' memory position into
/// the input of the object. Notice that sample rate _has_to_ be set before
/// calling this function, otherwise throws a runtime_error exception.
SOUNDTOUCHDLL_API int __cdecl soundtouch_putSamples(HANDLE h,
const SAMPLETYPE *samples, ///< Pointer to sample buffer.
unsigned int numSamples ///< Number of samples in buffer. Notice
///< that in case of stereo-sound a single sample
///< contains data for both channels.
)
{
STHANDLE *sth = (STHANDLE*)h;
if (sth->dwMagic != STMAGIC) return 0;
try
{
sth->pst->putSamples(samples, numSamples);
}
catch (const std::exception&)
{
return 0;
}
return 1;
}
/// int16 version of soundtouch_putSamples(): This accept int16 (short) sample data
/// and internally converts it to float format before processing
SOUNDTOUCHDLL_API void __cdecl soundtouch_putSamples_i16(HANDLE h,
const short *samples, ///< Pointer to sample buffer.
unsigned int numSamples ///< Number of sample frames in buffer. Notice
///< that in case of multi-channel sound a single sample
///< contains data for all channels.
)
{
STHANDLE *sth = (STHANDLE*)h;
if (sth->dwMagic != STMAGIC) return;
uint numChannels = sth->pst->numChannels();
// iterate until all samples converted & put to SoundTouch object
while (numSamples > 0)
{
float convert[8192]; // allocate temporary conversion buffer from stack
// how many multichannel samples fit into 'convert' buffer:
uint convSamples = 8192 / numChannels;
// convert max 'nround' values at a time to guarantee that these fit in the 'convert' buffer
uint n = (numSamples > convSamples) ? convSamples : numSamples;
for (uint i = 0; i < n * numChannels; i++)
{
convert[i] = samples[i];
}
// put the converted samples into SoundTouch
sth->pst->putSamples(convert, n);
numSamples -= n;
samples += n * numChannels;
}
}
/// Clears all the samples in the object's output and internal processing
/// buffers.
SOUNDTOUCHDLL_API void __cdecl soundtouch_clear(HANDLE h)
{
STHANDLE *sth = (STHANDLE*)h;
if (sth->dwMagic != STMAGIC) return;
sth->pst->clear();
}
/// Changes a setting controlling the processing system behaviour. See the
/// 'SETTING_...' defines for available setting ID's.
///
/// \return 'nonzero' if the setting was successfully changed
SOUNDTOUCHDLL_API int __cdecl soundtouch_setSetting(HANDLE h,
int settingId, ///< Setting ID number. see SETTING_... defines.
int value ///< New setting value.
)
{
STHANDLE *sth = (STHANDLE*)h;
if (sth->dwMagic != STMAGIC) return FALSE;
return sth->pst->setSetting(settingId, value);
}
/// Reads a setting controlling the processing system behaviour. See the
/// 'SETTING_...' defines for available setting ID's.
///
/// \return the setting value.
SOUNDTOUCHDLL_API int __cdecl soundtouch_getSetting(HANDLE h,
int settingId ///< Setting ID number, see SETTING_... defines.
)
{
STHANDLE *sth = (STHANDLE*)h;
if (sth->dwMagic != STMAGIC) return -1;
return sth->pst->getSetting(settingId);
}
/// Returns number of samples currently unprocessed.
SOUNDTOUCHDLL_API uint __cdecl soundtouch_numUnprocessedSamples(HANDLE h)
{
STHANDLE *sth = (STHANDLE*)h;
if (sth->dwMagic != STMAGIC) return 0;
return sth->pst->numUnprocessedSamples();
}
/// Receive ready samples from the processing pipeline.
///
/// if called with outBuffer=nullptr, just reduces amount of ready samples within the pipeline.
SOUNDTOUCHDLL_API uint __cdecl soundtouch_receiveSamples(HANDLE h,
SAMPLETYPE *outBuffer, ///< Buffer where to copy output samples.
unsigned int maxSamples ///< How many samples to receive at max.
)
{
STHANDLE *sth = (STHANDLE*)h;
if (sth->dwMagic != STMAGIC) return 0;
if (outBuffer)
{
return sth->pst->receiveSamples(outBuffer, maxSamples);
}
else
{
return sth->pst->receiveSamples(maxSamples);
}
}
/// int16 version of soundtouch_receiveSamples(): This converts internal float samples
/// into int16 (short) return data type
SOUNDTOUCHDLL_API uint __cdecl soundtouch_receiveSamples_i16(HANDLE h,
short *outBuffer, ///< Buffer where to copy output samples.
unsigned int maxSamples ///< How many samples to receive at max.
)
{
STHANDLE *sth = (STHANDLE*)h;
if (sth->dwMagic != STMAGIC) return 0;
uint outTotal = 0;
if (outBuffer == nullptr)
{
// only reduce sample count, not receive samples
return sth->pst->receiveSamples(maxSamples);
}
uint numChannels = sth->pst->numChannels();
// iterate until all samples converted & put to SoundTouch object
while (maxSamples > 0)
{
float convert[8192]; // allocate temporary conversion buffer from stack
// how many multichannel samples fit into 'convert' buffer:
uint convSamples = 8192 / numChannels;
// request max 'nround' values at a time to guarantee that these fit in the 'convert' buffer
uint n = (maxSamples > convSamples) ? convSamples : maxSamples;
uint out = sth->pst->receiveSamples(convert, n);
// convert & saturate received samples to int16
for (uint i = 0; i < out * numChannels; i++)
{
// first convert value to int32, then saturate to int16 min/max limits
int value = (int)convert[i];
value = (value < SHRT_MIN) ? SHRT_MIN : (value > SHRT_MAX) ? SHRT_MAX : value;
outBuffer[i] = (short)value;
}
outTotal += out;
if (out < n) break; // didn't get as many as asked => no more samples available => break here
maxSamples -= n;
outBuffer += out * numChannels;
}
// return number of processed samples
return outTotal;
}
/// Returns number of samples currently available.
SOUNDTOUCHDLL_API uint __cdecl soundtouch_numSamples(HANDLE h)
{
STHANDLE *sth = (STHANDLE*)h;
if (sth->dwMagic != STMAGIC) return 0;
return sth->pst->numSamples();
}
/// Returns nonzero if there aren't any samples available for outputting.
SOUNDTOUCHDLL_API int __cdecl soundtouch_isEmpty(HANDLE h)
{
STHANDLE *sth = (STHANDLE*)h;
if (sth->dwMagic != STMAGIC) return -1;
return sth->pst->isEmpty();
}
SOUNDTOUCHDLL_API HANDLE __cdecl bpm_createInstance(int numChannels, int sampleRate)
{
BPMHANDLE *tmp = new BPMHANDLE;
if (tmp)
{
tmp->dwMagic = BPMMAGIC;
try
{
tmp->pbpm = new BPMDetect(numChannels, sampleRate);
}
catch (const std::exception&)
{
tmp->pbpm = nullptr;
}
if (tmp->pbpm == nullptr)
{
delete tmp;
tmp = nullptr;
}
}
return (HANDLE)tmp;
}
SOUNDTOUCHDLL_API void __cdecl bpm_destroyInstance(HANDLE h)
{
BPMHANDLE *sth = (BPMHANDLE*)h;
if (sth->dwMagic != BPMMAGIC) return;
sth->dwMagic = 0;
if (sth->pbpm) delete sth->pbpm;
sth->pbpm = nullptr;
delete sth;
}
/// Feed 'numSamples' sample frames from 'samples' into the BPM detection handler
SOUNDTOUCHDLL_API void __cdecl bpm_putSamples(HANDLE h,
const float *samples,
unsigned int numSamples)
{
BPMHANDLE *bpmh = (BPMHANDLE*)h;
if (bpmh->dwMagic != BPMMAGIC) return;
bpmh->pbpm->inputSamples(samples, numSamples);
}
/// Feed 'numSamples' sample frames from 'samples' into the BPM detection handler.
/// 16bit int sample format version.
SOUNDTOUCHDLL_API void __cdecl bpm_putSamples_i16(HANDLE h,
const short *samples,
unsigned int numSamples)
{
BPMHANDLE *bpmh = (BPMHANDLE*)h;
if (bpmh->dwMagic != BPMMAGIC) return;
uint numChannels = bpmh->numChannels;
// iterate until all samples converted & put to SoundTouch object
while (numSamples > 0)
{
float convert[8192]; // allocate temporary conversion buffer from stack
// how many multichannel samples fit into 'convert' buffer:
uint convSamples = 8192 / numChannels;
// convert max 'nround' values at a time to guarantee that these fit in the 'convert' buffer
uint n = (numSamples > convSamples) ? convSamples : numSamples;
for (uint i = 0; i < n * numChannels; i++)
{
convert[i] = samples[i];
}
// put the converted samples into SoundTouch
bpmh->pbpm->inputSamples(convert, n);
numSamples -= n;
samples += n * numChannels;
}
}
/// Analyzes the results and returns the BPM rate. Use this function to read result
/// after whole song data has been input to the class by consecutive calls of
/// 'inputSamples' function.
///
/// \return Beats-per-minute rate, or zero if detection failed.
SOUNDTOUCHDLL_API float __cdecl bpm_getBpm(HANDLE h)
{
BPMHANDLE *bpmh = (BPMHANDLE*)h;
if (bpmh->dwMagic != BPMMAGIC) return 0;
return bpmh->pbpm->getBpm();
}
/// Get beat position arrays. Note: The array includes also really low beat detection values
/// in absence of clear strong beats. Consumer may wish to filter low values away.
/// - "pos" receive array of beat positions
/// - "values" receive array of beat detection strengths
/// - max_num indicates max.size of "pos" and "values" array.
///
/// You can query a suitable array sized by calling this with nullptr in "pos" & "values".
///
/// \return number of beats in the arrays.
SOUNDTOUCHDLL_API int __cdecl bpm_getBeats(HANDLE h, float* pos, float* strength, int count)
{
BPMHANDLE *bpmh = (BPMHANDLE *)h;
if (bpmh->dwMagic != BPMMAGIC) return 0;
return bpmh->pbpm->getBeats(pos, strength, count);
}

View File

@@ -0,0 +1,240 @@
//////////////////////////////////////////////////////////////////////////////
///
/// SoundTouch DLL wrapper - wraps SoundTouch routines into a Dynamic Load
/// Library interface.
///
/// Author : Copyright (c) Olli Parviainen
/// Author e-mail : oparviai 'at' iki.fi
/// SoundTouch WWW: http://www.surina.net/soundtouch
///
////////////////////////////////////////////////////////////////////////////////
//
// License :
//
// SoundTouch audio processing library
// Copyright (c) Olli Parviainen
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////
#ifndef _SoundTouchDLL_h_
#define _SoundTouchDLL_h_
#if defined(_WIN32) || defined(WIN32)
// Windows
#ifndef __cplusplus
#error "Expected g++"
#endif
#ifdef DLL_EXPORTS
#define SOUNDTOUCHDLL_API extern "C" __declspec(dllexport)
#else
#define SOUNDTOUCHDLL_API extern "C" __declspec(dllimport)
#endif
#else
// GNU version
#if defined(DLL_EXPORTS) || defined(SoundTouchDLL_EXPORTS)
// GCC declaration for exporting functions
#define SOUNDTOUCHDLL_API extern "C" __attribute__((__visibility__("default")))
#else
// GCC doesn't require DLL imports
#define SOUNDTOUCHDLL_API
#endif
// Linux-replacements for Windows declarations:
#define __cdecl
typedef unsigned int DWORD;
#define FALSE 0
#define TRUE 1
#endif
typedef void * HANDLE;
/// Create a new instance of SoundTouch processor.
SOUNDTOUCHDLL_API HANDLE __cdecl soundtouch_createInstance();
/// Destroys a SoundTouch processor instance.
SOUNDTOUCHDLL_API void __cdecl soundtouch_destroyInstance(HANDLE h);
/// Get SoundTouch library version string
SOUNDTOUCHDLL_API const char *__cdecl soundtouch_getVersionString();
/// Get SoundTouch library version string - alternative function for
/// environments that can't properly handle character string as return value
SOUNDTOUCHDLL_API void __cdecl soundtouch_getVersionString2(char* versionString, int bufferSize);
/// Get SoundTouch library version Id
SOUNDTOUCHDLL_API unsigned int __cdecl soundtouch_getVersionId();
/// Sets new rate control value. Normal rate = 1.0, smaller values
/// represent slower rate, larger faster rates.
SOUNDTOUCHDLL_API void __cdecl soundtouch_setRate(HANDLE h, float newRate);
/// Sets new tempo control value. Normal tempo = 1.0, smaller values
/// represent slower tempo, larger faster tempo.
SOUNDTOUCHDLL_API void __cdecl soundtouch_setTempo(HANDLE h, float newTempo);
/// Sets new rate control value as a difference in percents compared
/// to the original rate (-50 .. +100 %);
SOUNDTOUCHDLL_API void __cdecl soundtouch_setRateChange(HANDLE h, float newRate);
/// Sets new tempo control value as a difference in percents compared
/// to the original tempo (-50 .. +100 %);
SOUNDTOUCHDLL_API void __cdecl soundtouch_setTempoChange(HANDLE h, float newTempo);
/// Sets new pitch control value. Original pitch = 1.0, smaller values
/// represent lower pitches, larger values higher pitch.
SOUNDTOUCHDLL_API void __cdecl soundtouch_setPitch(HANDLE h, float newPitch);
/// Sets pitch change in octaves compared to the original pitch
/// (-1.00 .. +1.00);
SOUNDTOUCHDLL_API void __cdecl soundtouch_setPitchOctaves(HANDLE h, float newPitch);
/// Sets pitch change in semi-tones compared to the original pitch
/// (-12 .. +12);
SOUNDTOUCHDLL_API void __cdecl soundtouch_setPitchSemiTones(HANDLE h, float newPitch);
/// Sets the number of channels, 1 = mono, 2 = stereo, n = multichannel
SOUNDTOUCHDLL_API int __cdecl soundtouch_setChannels(HANDLE h, unsigned int numChannels);
/// Sets sample rate.
SOUNDTOUCHDLL_API int __cdecl soundtouch_setSampleRate(HANDLE h, unsigned int srate);
/// Flushes the last samples from the processing pipeline to the output.
/// Clears also the internal processing buffers.
//
/// Note: This function is meant for extracting the last samples of a sound
/// stream. This function may introduce additional blank samples in the end
/// of the sound stream, and thus it's not recommended to call this function
/// in the middle of a sound stream.
SOUNDTOUCHDLL_API int __cdecl soundtouch_flush(HANDLE h);
/// Adds 'numSamples' pcs of samples from the 'samples' memory position into
/// the input of the object. Notice that sample rate _has_to_ be set before
/// calling this function, otherwise throws a runtime_error exception.
SOUNDTOUCHDLL_API int __cdecl soundtouch_putSamples(HANDLE h,
const float *samples, ///< Pointer to sample buffer.
unsigned int numSamples ///< Number of sample frames in buffer. Notice
///< that in case of multi-channel sound a single
///< sample frame contains data for all channels.
);
/// int16 version of soundtouch_putSamples(): This accept int16 (short) sample data
/// and internally converts it to float format before processing
SOUNDTOUCHDLL_API void __cdecl soundtouch_putSamples_i16(HANDLE h,
const short *samples, ///< Pointer to sample buffer.
unsigned int numSamples ///< Number of sample frames in buffer. Notice
///< that in case of multi-channel sound a single
///< sample frame contains data for all channels.
);
/// Clears all the samples in the object's output and internal processing
/// buffers.
SOUNDTOUCHDLL_API void __cdecl soundtouch_clear(HANDLE h);
/// Changes a setting controlling the processing system behaviour. See the
/// 'SETTING_...' defines for available setting ID's.
///
/// \return 'nonzero' if the setting was successfully changed, otherwise zero
SOUNDTOUCHDLL_API int __cdecl soundtouch_setSetting(HANDLE h,
int settingId, ///< Setting ID number. see SETTING_... defines.
int value ///< New setting value.
);
/// Reads a setting controlling the processing system behaviour. See the
/// 'SETTING_...' defines for available setting ID's.
///
/// \return the setting value.
SOUNDTOUCHDLL_API int __cdecl soundtouch_getSetting(HANDLE h,
int settingId ///< Setting ID number, see SETTING_... defines.
);
/// Returns number of samples currently unprocessed.
SOUNDTOUCHDLL_API unsigned int __cdecl soundtouch_numUnprocessedSamples(HANDLE h);
/// Adjusts book-keeping so that given number of samples are removed from beginning of the
/// sample buffer without copying them anywhere.
///
/// Used to reduce the number of samples in the buffer when accessing the sample buffer directly
/// with 'ptrBegin' function.
SOUNDTOUCHDLL_API unsigned int __cdecl soundtouch_receiveSamples(HANDLE h,
float *outBuffer, ///< Buffer where to copy output samples.
unsigned int maxSamples ///< How many samples to receive at max.
);
/// int16 version of soundtouch_receiveSamples(): This converts internal float samples
/// into int16 (short) return data type
SOUNDTOUCHDLL_API unsigned int __cdecl soundtouch_receiveSamples_i16(HANDLE h,
short *outBuffer, ///< Buffer where to copy output samples.
unsigned int maxSamples ///< How many samples to receive at max.
);
/// Returns number of samples currently available.
SOUNDTOUCHDLL_API unsigned int __cdecl soundtouch_numSamples(HANDLE h);
/// Returns nonzero if there aren't any samples available for outputting.
SOUNDTOUCHDLL_API int __cdecl soundtouch_isEmpty(HANDLE h);
/// Create a new instance of BPM detector
SOUNDTOUCHDLL_API HANDLE __cdecl bpm_createInstance(int numChannels, int sampleRate);
/// Destroys a BPM detector instance.
SOUNDTOUCHDLL_API void __cdecl bpm_destroyInstance(HANDLE h);
/// Feed 'numSamples' sample frames from 'samples' into the BPM detector.
SOUNDTOUCHDLL_API void __cdecl bpm_putSamples(HANDLE h,
const float *samples, ///< Pointer to sample buffer.
unsigned int numSamples ///< Number of samples in buffer. Notice
///< that in case of stereo-sound a single sample
///< contains data for both channels.
);
/// Feed 'numSamples' sample frames from 'samples' into the BPM detector.
/// 16bit int sample format version.
SOUNDTOUCHDLL_API void __cdecl bpm_putSamples_i16(HANDLE h,
const short *samples, ///< Pointer to sample buffer.
unsigned int numSamples ///< Number of samples in buffer. Notice
///< that in case of stereo-sound a single sample
///< contains data for both channels.
);
/// Analyzes the results and returns the BPM rate. Use this function to read result
/// after whole song data has been input to the class by consecutive calls of
/// 'inputSamples' function.
///
/// \return Beats-per-minute rate, or zero if detection failed.
SOUNDTOUCHDLL_API float __cdecl bpm_getBpm(HANDLE h);
/// Get beat position arrays. Note: The array includes also really low beat detection values
/// in absence of clear strong beats. Consumer may wish to filter low values away.
/// - "pos" receive array of beat positions
/// - "values" receive array of beat detection strengths
/// - max_num indicates max.size of "pos" and "values" array.
///
/// You can query a suitable array sized by calling this with nullptr in "pos" & "values".
///
/// \return number of beats in the arrays.
SOUNDTOUCHDLL_API int __cdecl bpm_getBeats(HANDLE h, float *pos, float *strength, int count);
#endif // _SoundTouchDLL_h_

View File

@@ -0,0 +1,100 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,2,0,0
PRODUCTVERSION 2,2,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "000004b0"
BEGIN
VALUE "Comments", "SoundTouch Library licensed for 3rd party applications subject to LGPL license v2.1. Visit http://www.surina.net/soundtouch for more information about the SoundTouch library."
VALUE "FileDescription", "SoundTouch Dynamic Link Library"
VALUE "FileVersion", "2.3.2.0"
VALUE "InternalName", "SoundTouch"
VALUE "LegalCopyright", "Copyright (C) Olli Parviainen 2022"
VALUE "OriginalFilename", "SoundTouch.dll"
VALUE "ProductName", " SoundTouch Dynamic Link Library"
VALUE "ProductVersion", "2.3.2.0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0, 1200
END
END
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,50 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SoundTouchDLL", "SoundTouchDLL.vcxproj", "{164DE61D-6391-4265-8273-30740117D356}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SoundTouch", "..\SoundTouch\SoundTouch.vcxproj", "{68A5DD20-7057-448B-8FE0-B6AC8D205509}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DllTest", "DllTest\DllTest.vcxproj", "{E3C0726F-28F4-4F0B-8183-B87CA60C063C}"
ProjectSection(ProjectDependencies) = postProject
{164DE61D-6391-4265-8273-30740117D356} = {164DE61D-6391-4265-8273-30740117D356}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{164DE61D-6391-4265-8273-30740117D356}.Debug|Win32.ActiveCfg = Debug|Win32
{164DE61D-6391-4265-8273-30740117D356}.Debug|Win32.Build.0 = Debug|Win32
{164DE61D-6391-4265-8273-30740117D356}.Debug|x64.ActiveCfg = Debug|x64
{164DE61D-6391-4265-8273-30740117D356}.Debug|x64.Build.0 = Debug|x64
{164DE61D-6391-4265-8273-30740117D356}.Release|Win32.ActiveCfg = Release|Win32
{164DE61D-6391-4265-8273-30740117D356}.Release|Win32.Build.0 = Release|Win32
{164DE61D-6391-4265-8273-30740117D356}.Release|x64.ActiveCfg = Release|x64
{164DE61D-6391-4265-8273-30740117D356}.Release|x64.Build.0 = Release|x64
{68A5DD20-7057-448B-8FE0-B6AC8D205509}.Debug|Win32.ActiveCfg = Debug|Win32
{68A5DD20-7057-448B-8FE0-B6AC8D205509}.Debug|Win32.Build.0 = Debug|Win32
{68A5DD20-7057-448B-8FE0-B6AC8D205509}.Debug|x64.ActiveCfg = Debug|x64
{68A5DD20-7057-448B-8FE0-B6AC8D205509}.Debug|x64.Build.0 = Debug|x64
{68A5DD20-7057-448B-8FE0-B6AC8D205509}.Release|Win32.ActiveCfg = Release|Win32
{68A5DD20-7057-448B-8FE0-B6AC8D205509}.Release|Win32.Build.0 = Release|Win32
{68A5DD20-7057-448B-8FE0-B6AC8D205509}.Release|x64.ActiveCfg = Release|x64
{68A5DD20-7057-448B-8FE0-B6AC8D205509}.Release|x64.Build.0 = Release|x64
{E3C0726F-28F4-4F0B-8183-B87CA60C063C}.Debug|Win32.ActiveCfg = Debug|Win32
{E3C0726F-28F4-4F0B-8183-B87CA60C063C}.Debug|Win32.Build.0 = Debug|Win32
{E3C0726F-28F4-4F0B-8183-B87CA60C063C}.Debug|x64.ActiveCfg = Debug|x64
{E3C0726F-28F4-4F0B-8183-B87CA60C063C}.Debug|x64.Build.0 = Debug|x64
{E3C0726F-28F4-4F0B-8183-B87CA60C063C}.Release|Win32.ActiveCfg = Release|Win32
{E3C0726F-28F4-4F0B-8183-B87CA60C063C}.Release|Win32.Build.0 = Release|Win32
{E3C0726F-28F4-4F0B-8183-B87CA60C063C}.Release|x64.ActiveCfg = Release|x64
{E3C0726F-28F4-4F0B-8183-B87CA60C063C}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,273 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{164DE61D-6391-4265-8273-30740117D356}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>14.0.23107.0</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental>true</LinkIncremental>
<TargetName>$(ProjectName)D</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental>true</LinkIncremental>
<TargetName>$(ProjectName)D_x64</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental>false</LinkIncremental>
<TargetName>$(ProjectName)_x64</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>
</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<PrecompiledHeaderOutputFile>$(OutDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(OutDir)</AssemblerListingLocation>
<ObjectFileName>$(OutDir)</ObjectFileName>
<ProgramDataBaseFileName>$(OutDir)</ProgramDataBaseFileName>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
</ClCompile>
<Link>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<IgnoreSpecificDefaultLibraries>libcd;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)SoundTouchD.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
<PostBuildEvent>
<Command>if not exist ..\..\lib mkdir ..\..\lib
copy $(OutDir)$(TargetName)$(TargetExt) ..\..\lib
copy $(OutDir)$(TargetName).lib ..\..\lib
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>
</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<PrecompiledHeaderOutputFile>$(OutDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(OutDir)</AssemblerListingLocation>
<ObjectFileName>$(OutDir)</ObjectFileName>
<ProgramDataBaseFileName>$(OutDir)</ProgramDataBaseFileName>
</ClCompile>
<Link>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<IgnoreSpecificDefaultLibraries>libcd;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)SoundTouchD.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
<TargetMachine>MachineX64</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
<PostBuildEvent>
<Command>if not exist ..\..\lib mkdir ..\..\lib
copy $(OutDir)$(TargetName)$(TargetExt) ..\..\lib
copy $(OutDir)$(TargetName).lib ..\..\lib
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<OmitFramePointers>false</OmitFramePointers>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat />
<CallingConvention>Cdecl</CallingConvention>
<PrecompiledHeaderOutputFile>$(OutDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(OutDir)</AssemblerListingLocation>
<ObjectFileName>$(OutDir)</ObjectFileName>
<ProgramDataBaseFileName>$(OutDir)</ProgramDataBaseFileName>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<MinimalRebuild />
</ClCompile>
<Link>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<IgnoreSpecificDefaultLibraries>libc;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>false</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PostBuildEvent>
<Command>if not exist ..\..\lib mkdir ..\..\lib
copy $(OutDir)$(TargetName)$(TargetExt) ..\..\lib
copy $(OutDir)$(TargetName).lib ..\..\lib
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<OmitFramePointers>false</OmitFramePointers>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat />
<CallingConvention>Cdecl</CallingConvention>
<PrecompiledHeaderOutputFile>$(OutDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(OutDir)</AssemblerListingLocation>
<ObjectFileName>$(OutDir)</ObjectFileName>
<ProgramDataBaseFileName>$(OutDir)</ProgramDataBaseFileName>
<MinimalRebuild />
</ClCompile>
<Link>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<IgnoreSpecificDefaultLibraries>libc;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>false</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention />
<ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
<TargetMachine>MachineX64</TargetMachine>
</Link>
<PostBuildEvent>
<Command>if not exist ..\..\lib mkdir ..\..\lib
copy $(OutDir)$(TargetName)$(TargetExt) ..\..\lib
copy $(OutDir)$(TargetName).lib ..\..\lib
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="SoundTouchDLL.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h" />
<ClInclude Include="SoundTouchDLL.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="SoundTouchDLL.rc" />
</ItemGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SoundTouch\SoundTouch.vcxproj">
<Project>{68a5dd20-7057-448b-8fe0-b6ac8d205509}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,29 @@
#!/bin/bash
#
# This script is deprecated. Don't use this, the makefile can now compile
# the dynamic-link library 'libSoundTouchDLL.so' automatically.
#
# This script compiles SoundTouch dynamic-link library for GNU environment
# with wrapper functions that are easier to import to Java / Mono / etc
#
arch=$(uname -m)
flags=""
if [[ $arch == *"86"* ]]; then
# Intel x86/x64 architecture
flags="$flags -mstackrealign -msse"
if [[ $arch == *"_64" ]]; then
flags="$flags -fPIC"
fi
fi
echo "*************************************************************************"
echo "NOTE: Rather use the makefile that can now build the dynamic-link library"
echo "*************************************************************************"
echo ""
echo "Building SoundTouchDLL for $arch with flags:$flags"
g++ -O3 -ffast-math -shared $flags -DDLL_EXPORTS -fvisibility=hidden -I../../include \
-I../SoundTouch -o SoundTouchDll.so SoundTouchDLL.cpp ../SoundTouch/*.cpp

View File

@@ -0,0 +1,15 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by SoundTouchDLL.rc
//
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif