mirror of
https://github.com/azahar-emu/soundtouch
synced 2025-11-07 07:30:02 +01:00
GNU compilation of SoundTouchDll that has easy function importing interfaces for java, mono etc
This commit is contained in:
parent
05a3403137
commit
407f516e0d
@ -34,23 +34,16 @@
|
|||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "SoundTouchDLL.h"
|
|
||||||
#include "soundtouch.h"
|
|
||||||
|
|
||||||
using namespace soundtouch;
|
#if defined(_WIN32) || defined(WIN32)
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
#ifdef SOUNDTOUCH_INTEGER_SAMPLES
|
// DLL main in Windows compilation
|
||||||
#error "error - compile the dll version with float samples"
|
BOOL APIENTRY DllMain( HANDLE hModule,
|
||||||
#endif // SOUNDTOUCH_INTEGER_SAMPLES
|
|
||||||
|
|
||||||
|
|
||||||
BOOL APIENTRY DllMain( HANDLE hModule,
|
|
||||||
DWORD ul_reason_for_call,
|
DWORD ul_reason_for_call,
|
||||||
LPVOID lpReserved
|
LPVOID lpReserved
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
switch (ul_reason_for_call)
|
switch (ul_reason_for_call)
|
||||||
{
|
{
|
||||||
case DLL_PROCESS_ATTACH:
|
case DLL_PROCESS_ATTACH:
|
||||||
@ -60,8 +53,19 @@ BOOL APIENTRY DllMain( HANDLE hModule,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <limits.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "SoundTouchDLL.h"
|
||||||
|
#include "SoundTouch.h"
|
||||||
|
|
||||||
|
using namespace soundtouch;
|
||||||
|
|
||||||
|
#ifdef SOUNDTOUCH_INTEGER_SAMPLES
|
||||||
|
#error "error - compile the dll version with float samples"
|
||||||
|
#endif // SOUNDTOUCH_INTEGER_SAMPLES
|
||||||
|
|
||||||
//////////////
|
//////////////
|
||||||
|
|
||||||
|
|||||||
@ -37,24 +37,37 @@
|
|||||||
#ifndef _SoundTouchDLL_h_
|
#ifndef _SoundTouchDLL_h_
|
||||||
#define _SoundTouchDLL_h_
|
#define _SoundTouchDLL_h_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#if defined(_WIN32) || defined(WIN32)
|
||||||
|
// Windows
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#error "Expected g++"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef DLL_EXPORTS
|
#ifdef DLL_EXPORTS
|
||||||
#define SOUNDTOUCHDLL_API extern "C" __declspec(dllexport)
|
#define SOUNDTOUCHDLL_API extern "C" __declspec(dllexport)
|
||||||
#else
|
#else
|
||||||
#define SOUNDTOUCHDLL_API extern "C" __declspec(dllimport)
|
#define SOUNDTOUCHDLL_API extern "C" __declspec(dllimport)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
// GNU version
|
||||||
|
|
||||||
|
#ifdef DLL_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
|
||||||
|
|
||||||
#ifdef DLL_EXPORTS
|
|
||||||
#define SOUNDTOUCHDLL_API __declspec(dllexport)
|
|
||||||
#else
|
|
||||||
#define SOUNDTOUCHDLL_API __declspec(dllimport)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // __cplusplus
|
|
||||||
|
|
||||||
typedef void * HANDLE;
|
typedef void * HANDLE;
|
||||||
|
|
||||||
/// Create a new instance of SoundTouch processor.
|
/// Create a new instance of SoundTouch processor.
|
||||||
|
|||||||
8
source/SoundTouchDLL/make-gnu-dll.sh
Executable file
8
source/SoundTouchDLL/make-gnu-dll.sh
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# This script compiles SoundTouch dynamic-link library for GNU environment
|
||||||
|
# with wrapper functions that are easier to import to Java / Mono / etc
|
||||||
|
#
|
||||||
|
|
||||||
|
g++ -fPIC -shared -DDLL_EXPORTS -fvisibility=hidden -I../../include -o SoundTouchDll.so \
|
||||||
|
SoundTouchDLL.cpp ../SoundTouch/*.cpp -I../SoundTouch -O3 -msse
|
||||||
Loading…
x
Reference in New Issue
Block a user