First Commit
This commit is contained in:
10
externals/soundtouch/source/SoundTouchDLL/LazarusTest/README.txt
vendored
Normal file
10
externals/soundtouch/source/SoundTouchDLL/LazarusTest/README.txt
vendored
Normal 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.
|
||||
504
externals/soundtouch/source/SoundTouchDLL/LazarusTest/SoundTouchDLL.pas
vendored
Normal file
504
externals/soundtouch/source/SoundTouchDLL/LazarusTest/SoundTouchDLL.pas
vendored
Normal 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.
|
||||
36
externals/soundtouch/source/SoundTouchDLL/LazarusTest/main.lfm
vendored
Normal file
36
externals/soundtouch/source/SoundTouchDLL/LazarusTest/main.lfm
vendored
Normal 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
|
||||
49
externals/soundtouch/source/SoundTouchDLL/LazarusTest/main.pas
vendored
Normal file
49
externals/soundtouch/source/SoundTouchDLL/LazarusTest/main.pas
vendored
Normal 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.
|
||||
|
||||
BIN
externals/soundtouch/source/SoundTouchDLL/LazarusTest/soundtouchtest.ico
vendored
Normal file
BIN
externals/soundtouch/source/SoundTouchDLL/LazarusTest/soundtouchtest.ico
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 64 KiB |
78
externals/soundtouch/source/SoundTouchDLL/LazarusTest/soundtouchtest.lpi
vendored
Normal file
78
externals/soundtouch/source/SoundTouchDLL/LazarusTest/soundtouchtest.lpi
vendored
Normal 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>
|
||||
25
externals/soundtouch/source/SoundTouchDLL/LazarusTest/soundtouchtest.lpr
vendored
Normal file
25
externals/soundtouch/source/SoundTouchDLL/LazarusTest/soundtouchtest.lpr
vendored
Normal 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.
|
||||
|
||||
186
externals/soundtouch/source/SoundTouchDLL/LazarusTest/soundtouchtest.lps
vendored
Normal file
186
externals/soundtouch/source/SoundTouchDLL/LazarusTest/soundtouchtest.lps
vendored
Normal 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>
|
||||
Reference in New Issue
Block a user