diff --git a/README.html b/README.html index 3d29c41..f8bebd7 100644 --- a/README.html +++ b/README.html @@ -738,6 +738,7 @@ submitted bugfixes since SoundTouch v1.3.1:
Moral greetings to all other contributors and users also!
diff --git a/source/SoundTouchDLL/SoundTouchDLL.cpp b/source/SoundTouchDLL/SoundTouchDLL.cpp index bd6967e..5dd28b9 100644 --- a/source/SoundTouchDLL/SoundTouchDLL.cpp +++ b/source/SoundTouchDLL/SoundTouchDLL.cpp @@ -68,7 +68,7 @@ typedef struct #define STMAGIC 0x1770C001 -SOUNDTOUCHDLL_API HANDLE __stdcall soundtouch_createInstance() +SOUNDTOUCHDLL_API HANDLE __cdecl soundtouch_createInstance() { STHANDLE *tmp = new STHANDLE; @@ -86,7 +86,7 @@ SOUNDTOUCHDLL_API HANDLE __stdcall soundtouch_createInstance() } -SOUNDTOUCHDLL_API void __stdcall soundtouch_destroyInstance(HANDLE h) +SOUNDTOUCHDLL_API void __cdecl soundtouch_destroyInstance(HANDLE h) { /* STHANDLE *sth = (STHANDLE*)h; @@ -103,7 +103,7 @@ SOUNDTOUCHDLL_API void __stdcall soundtouch_destroyInstance(HANDLE h) /// Get SoundTouch library version string -SOUNDTOUCHDLL_API const char *__stdcall soundtouch_getVersionString() +SOUNDTOUCHDLL_API const char *__cdecl soundtouch_getVersionString() { return SoundTouch::getVersionString(); } @@ -111,7 +111,7 @@ SOUNDTOUCHDLL_API const char *__stdcall soundtouch_getVersionString() /// Get SoundTouch library version string - alternative function for /// environments that can't properly handle character string as return value -SOUNDTOUCHDLL_API void __stdcall soundtouch_getVersionString2(char* versionString, int bufferSize) +SOUNDTOUCHDLL_API void __cdecl soundtouch_getVersionString2(char* versionString, int bufferSize) { strncpy(versionString, SoundTouch::getVersionString(), bufferSize - 1); versionString[bufferSize - 1] = 0; @@ -119,14 +119,14 @@ SOUNDTOUCHDLL_API void __stdcall soundtouch_getVersionString2(char* versionStrin /// Get SoundTouch library version Id -SOUNDTOUCHDLL_API uint __stdcall soundtouch_getVersionId() +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 __stdcall soundtouch_setRate(HANDLE h, float newRate) +SOUNDTOUCHDLL_API void __cdecl soundtouch_setRate(HANDLE h, float newRate) { STHANDLE *sth = (STHANDLE*)h; if (sth->dwMagic != STMAGIC) return; @@ -137,7 +137,7 @@ SOUNDTOUCHDLL_API void __stdcall 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 __stdcall soundtouch_setTempo(HANDLE h, float newTempo) +SOUNDTOUCHDLL_API void __cdecl soundtouch_setTempo(HANDLE h, float newTempo) { STHANDLE *sth = (STHANDLE*)h; if (sth->dwMagic != STMAGIC) return; @@ -147,7 +147,7 @@ SOUNDTOUCHDLL_API void __stdcall 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 __stdcall soundtouch_setRateChange(HANDLE h, float newRate) +SOUNDTOUCHDLL_API void __cdecl soundtouch_setRateChange(HANDLE h, float newRate) { STHANDLE *sth = (STHANDLE*)h; if (sth->dwMagic != STMAGIC) return; @@ -157,7 +157,7 @@ SOUNDTOUCHDLL_API void __stdcall soundtouch_setRateChange(HANDLE h, float newRat /// Sets new tempo control value as a difference in percents compared /// to the original tempo (-50 .. +100 %) -SOUNDTOUCHDLL_API void __stdcall soundtouch_setTempoChange(HANDLE h, float newTempo) +SOUNDTOUCHDLL_API void __cdecl soundtouch_setTempoChange(HANDLE h, float newTempo) { STHANDLE *sth = (STHANDLE*)h; if (sth->dwMagic != STMAGIC) return; @@ -167,7 +167,7 @@ SOUNDTOUCHDLL_API void __stdcall soundtouch_setTempoChange(HANDLE h, float newTe /// Sets new pitch control value. Original pitch = 1.0, smaller values /// represent lower pitches, larger values higher pitch. -SOUNDTOUCHDLL_API void __stdcall soundtouch_setPitch(HANDLE h, float newPitch) +SOUNDTOUCHDLL_API void __cdecl soundtouch_setPitch(HANDLE h, float newPitch) { STHANDLE *sth = (STHANDLE*)h; if (sth->dwMagic != STMAGIC) return; @@ -177,7 +177,7 @@ SOUNDTOUCHDLL_API void __stdcall soundtouch_setPitch(HANDLE h, float newPitch) /// Sets pitch change in octaves compared to the original pitch /// (-1.00 .. +1.00) -SOUNDTOUCHDLL_API void __stdcall soundtouch_setPitchOctaves(HANDLE h, float newPitch) +SOUNDTOUCHDLL_API void __cdecl soundtouch_setPitchOctaves(HANDLE h, float newPitch) { STHANDLE *sth = (STHANDLE*)h; if (sth->dwMagic != STMAGIC) return; @@ -187,7 +187,7 @@ SOUNDTOUCHDLL_API void __stdcall soundtouch_setPitchOctaves(HANDLE h, float newP /// Sets pitch change in semi-tones compared to the original pitch /// (-12 .. +12) -SOUNDTOUCHDLL_API void __stdcall soundtouch_setPitchSemiTones(HANDLE h, float newPitch) +SOUNDTOUCHDLL_API void __cdecl soundtouch_setPitchSemiTones(HANDLE h, float newPitch) { STHANDLE *sth = (STHANDLE*)h; if (sth->dwMagic != STMAGIC) return; @@ -197,7 +197,7 @@ SOUNDTOUCHDLL_API void __stdcall soundtouch_setPitchSemiTones(HANDLE h, float ne /// Sets the number of channels, 1 = mono, 2 = stereo -SOUNDTOUCHDLL_API void __stdcall soundtouch_setChannels(HANDLE h, uint numChannels) +SOUNDTOUCHDLL_API void __cdecl soundtouch_setChannels(HANDLE h, uint numChannels) { STHANDLE *sth = (STHANDLE*)h; if (sth->dwMagic != STMAGIC) return; @@ -206,7 +206,7 @@ SOUNDTOUCHDLL_API void __stdcall soundtouch_setChannels(HANDLE h, uint numChanne } /// Sets sample rate. -SOUNDTOUCHDLL_API void __stdcall soundtouch_setSampleRate(HANDLE h, uint srate) +SOUNDTOUCHDLL_API void __cdecl soundtouch_setSampleRate(HANDLE h, uint srate) { STHANDLE *sth = (STHANDLE*)h; if (sth->dwMagic != STMAGIC) return; @@ -221,7 +221,7 @@ SOUNDTOUCHDLL_API void __stdcall soundtouch_setSampleRate(HANDLE h, uint srate) /// 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 void __stdcall soundtouch_flush(HANDLE h) +SOUNDTOUCHDLL_API void __cdecl soundtouch_flush(HANDLE h) { STHANDLE *sth = (STHANDLE*)h; if (sth->dwMagic != STMAGIC) return; @@ -232,7 +232,7 @@ SOUNDTOUCHDLL_API void __stdcall 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 void __stdcall soundtouch_putSamples(HANDLE h, +SOUNDTOUCHDLL_API void __cdecl soundtouch_putSamples(HANDLE h, const SAMPLETYPE *samples, ///< Pointer to sample buffer. uint numSamples ///< Number of samples in buffer. Notice ///< that in case of stereo-sound a single sample @@ -247,7 +247,7 @@ SOUNDTOUCHDLL_API void __stdcall soundtouch_putSamples(HANDLE h, /// Clears all the samples in the object's output and internal processing /// buffers. -SOUNDTOUCHDLL_API void __stdcall soundtouch_clear(HANDLE h) +SOUNDTOUCHDLL_API void __cdecl soundtouch_clear(HANDLE h) { STHANDLE *sth = (STHANDLE*)h; if (sth->dwMagic != STMAGIC) return; @@ -259,7 +259,7 @@ SOUNDTOUCHDLL_API void __stdcall soundtouch_clear(HANDLE h) /// 'SETTING_...' defines for available setting ID's. /// /// \return 'TRUE' if the setting was succesfully changed -SOUNDTOUCHDLL_API BOOL __stdcall soundtouch_setSetting(HANDLE h, +SOUNDTOUCHDLL_API BOOL __cdecl soundtouch_setSetting(HANDLE h, int settingId, ///< Setting ID number. see SETTING_... defines. int value ///< New setting value. ) @@ -274,7 +274,7 @@ SOUNDTOUCHDLL_API BOOL __stdcall soundtouch_setSetting(HANDLE h, /// 'SETTING_...' defines for available setting ID's. /// /// \return the setting value. -SOUNDTOUCHDLL_API int __stdcall soundtouch_getSetting(HANDLE h, +SOUNDTOUCHDLL_API int __cdecl soundtouch_getSetting(HANDLE h, int settingId ///< Setting ID number, see SETTING_... defines. ) { @@ -286,7 +286,7 @@ SOUNDTOUCHDLL_API int __stdcall soundtouch_getSetting(HANDLE h, /// Returns number of samples currently unprocessed. -SOUNDTOUCHDLL_API uint __stdcall soundtouch_numUnprocessedSamples(HANDLE h) +SOUNDTOUCHDLL_API uint __cdecl soundtouch_numUnprocessedSamples(HANDLE h) { STHANDLE *sth = (STHANDLE*)h; if (sth->dwMagic != STMAGIC) return 0; @@ -300,7 +300,7 @@ SOUNDTOUCHDLL_API uint __stdcall soundtouch_numUnprocessedSamples(HANDLE h) /// /// Used to reduce the number of samples in the buffer when accessing the sample buffer directly /// with 'ptrBegin' function. -SOUNDTOUCHDLL_API uint __stdcall soundtouch_receiveSamples(HANDLE h, +SOUNDTOUCHDLL_API uint __cdecl soundtouch_receiveSamples(HANDLE h, SAMPLETYPE *outBuffer, ///< Buffer where to copy output samples. uint maxSamples ///< How many samples to receive at max. ) @@ -319,7 +319,7 @@ SOUNDTOUCHDLL_API uint __stdcall soundtouch_receiveSamples(HANDLE h, } /// Returns number of samples currently available. -SOUNDTOUCHDLL_API uint __stdcall soundtouch_numSamples(HANDLE h) +SOUNDTOUCHDLL_API uint __cdecl soundtouch_numSamples(HANDLE h) { STHANDLE *sth = (STHANDLE*)h; if (sth->dwMagic != STMAGIC) return 0; @@ -329,7 +329,7 @@ SOUNDTOUCHDLL_API uint __stdcall soundtouch_numSamples(HANDLE h) /// Returns nonzero if there aren't any samples available for outputting. -SOUNDTOUCHDLL_API int __stdcall soundtouch_isEmpty(HANDLE h) +SOUNDTOUCHDLL_API int __cdecl soundtouch_isEmpty(HANDLE h) { STHANDLE *sth = (STHANDLE*)h; if (sth->dwMagic != STMAGIC) return -1; diff --git a/source/SoundTouchDLL/SoundTouchDLL.h b/source/SoundTouchDLL/SoundTouchDLL.h index 1d8f17a..a384dfe 100644 --- a/source/SoundTouchDLL/SoundTouchDLL.h +++ b/source/SoundTouchDLL/SoundTouchDLL.h @@ -38,67 +38,75 @@ #define _SoundTouchDLL_h_ #ifdef __cplusplus -extern "C" { + +#ifdef DLL_EXPORTS + #define SOUNDTOUCHDLL_API extern "C" __declspec(dllexport) +#else + #define SOUNDTOUCHDLL_API extern "C" __declspec(dllimport) #endif +#else + #ifdef DLL_EXPORTS #define SOUNDTOUCHDLL_API __declspec(dllexport) #else #define SOUNDTOUCHDLL_API __declspec(dllimport) #endif +#endif // __cplusplus + typedef void * HANDLE; /// Create a new instance of SoundTouch processor. -SOUNDTOUCHDLL_API HANDLE __stdcall soundtouch_createInstance(); +SOUNDTOUCHDLL_API HANDLE __cdecl soundtouch_createInstance(); /// Destroys a SoundTouch processor instance. -SOUNDTOUCHDLL_API void __stdcall soundtouch_destroyInstance(HANDLE h); +SOUNDTOUCHDLL_API void __cdecl soundtouch_destroyInstance(HANDLE h); /// Get SoundTouch library version string -SOUNDTOUCHDLL_API const char *__stdcall soundtouch_getVersionString(); +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 __stdcall soundtouch_getVersionString2(char* versionString, int bufferSize); +SOUNDTOUCHDLL_API void __cdecl soundtouch_getVersionString2(char* versionString, int bufferSize); /// Get SoundTouch library version Id -SOUNDTOUCHDLL_API unsigned int __stdcall soundtouch_getVersionId(); +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 __stdcall soundtouch_setRate(HANDLE h, float newRate); +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 __stdcall soundtouch_setTempo(HANDLE h, float newTempo); +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 __stdcall soundtouch_setRateChange(HANDLE h, float newRate); +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 __stdcall soundtouch_setTempoChange(HANDLE h, float newTempo); +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 __stdcall soundtouch_setPitch(HANDLE h, float newPitch); +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 __stdcall soundtouch_setPitchOctaves(HANDLE h, float newPitch); +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 __stdcall soundtouch_setPitchSemiTones(HANDLE h, float newPitch); +SOUNDTOUCHDLL_API void __cdecl soundtouch_setPitchSemiTones(HANDLE h, float newPitch); /// Sets the number of channels, 1 = mono, 2 = stereo -SOUNDTOUCHDLL_API void __stdcall soundtouch_setChannels(HANDLE h, unsigned int numChannels); +SOUNDTOUCHDLL_API void __cdecl soundtouch_setChannels(HANDLE h, unsigned int numChannels); /// Sets sample rate. -SOUNDTOUCHDLL_API void __stdcall soundtouch_setSampleRate(HANDLE h, unsigned int srate); +SOUNDTOUCHDLL_API void __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. @@ -107,12 +115,12 @@ SOUNDTOUCHDLL_API void __stdcall soundtouch_setSampleRate(HANDLE h, unsigned int /// 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 void __stdcall soundtouch_flush(HANDLE h); +SOUNDTOUCHDLL_API void __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 void __stdcall soundtouch_putSamples(HANDLE h, +SOUNDTOUCHDLL_API void __cdecl soundtouch_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 @@ -121,13 +129,13 @@ SOUNDTOUCHDLL_API void __stdcall soundtouch_putSamples(HANDLE h, /// Clears all the samples in the object's output and internal processing /// buffers. -SOUNDTOUCHDLL_API void __stdcall soundtouch_clear(HANDLE h); +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 'TRUE' if the setting was succesfully changed -SOUNDTOUCHDLL_API BOOL __stdcall soundtouch_setSetting(HANDLE h, +SOUNDTOUCHDLL_API BOOL __cdecl soundtouch_setSetting(HANDLE h, int settingId, ///< Setting ID number. see SETTING_... defines. int value ///< New setting value. ); @@ -136,33 +144,29 @@ SOUNDTOUCHDLL_API BOOL __stdcall soundtouch_setSetting(HANDLE h, /// 'SETTING_...' defines for available setting ID's. /// /// \return the setting value. -SOUNDTOUCHDLL_API int __stdcall soundtouch_getSetting(HANDLE h, +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 __stdcall soundtouch_numUnprocessedSamples(HANDLE h); +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 __stdcall soundtouch_receiveSamples(HANDLE h, +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. ); /// Returns number of samples currently available. -SOUNDTOUCHDLL_API unsigned int __stdcall soundtouch_numSamples(HANDLE h); +SOUNDTOUCHDLL_API unsigned int __cdecl soundtouch_numSamples(HANDLE h); /// Returns nonzero if there aren't any samples available for outputting. -SOUNDTOUCHDLL_API int __stdcall soundtouch_isEmpty(HANDLE h); - -#ifdef __cplusplus -} -#endif +SOUNDTOUCHDLL_API int __cdecl soundtouch_isEmpty(HANDLE h); #endif // _SoundTouchDLL_h_ diff --git a/source/SoundTouchDLL/SoundTouchDLL.pas b/source/SoundTouchDLL/SoundTouchDLL.pas index 8b02894..6dcf1cc 100644 --- a/source/SoundTouchDLL/SoundTouchDLL.pas +++ b/source/SoundTouchDLL/SoundTouchDLL.pas @@ -5,7 +5,9 @@ unit SoundTouchDLL; // SoundTouch.dll wrapper for accessing SoundTouch routines from Delphi/Pascal // // Module Author : Christian Budde -// +// +// 2014-01-12 fixes by Sandro Cumerlato