Added the ability to disable the plugin system with a define.
This commit is contained in:
parent
7d29b49a29
commit
97c7135bbc
|
@ -1,6 +1,8 @@
|
|||
#ifndef CPLUGINMANAGER_H_INCLUDED
|
||||
#define CPLUGINMANAGER_H_INCLUDED
|
||||
|
||||
#ifdef CAUDIO_COMPILE_WITH_PLUGIN_SUPPORT
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
@ -12,38 +14,30 @@
|
|||
#ifdef CAUDIO_PLATFORM_WIN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef CAUDIO_PLATFORM_MAC
|
||||
# include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#ifdef CAUDIO_PLATFORM_LINUX
|
||||
# include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#ifdef CAUDIO_PLATFORM_WIN
|
||||
# define DYNLIB_HANDLE hInstance
|
||||
# define DYNLIB_LOAD( a ) LoadLibraryEx( a, NULL, LOAD_WITH_ALTERED_SEARCH_PATH )
|
||||
# define DYNLIB_GETSYM( a, b ) GetProcAddress( a, b )
|
||||
# define DYNLIB_UNLOAD( a ) !FreeLibrary( a )
|
||||
#endif
|
||||
|
||||
struct HINSTANCE__;
|
||||
typedef struct HINSTANCE__* hInstance;
|
||||
|
||||
#ifdef CAUDIO_PLATFORM_LINUX
|
||||
# define DYNLIB_HANDLE void*
|
||||
# define DYNLIB_LOAD( a ) dlopen( a, RTLD_LAZY | RTLD_GLOBAL)
|
||||
# define DYNLIB_GETSYM( a, b ) dlsym( a, b )
|
||||
# define DYNLIB_UNLOAD( a ) dlclose( a )
|
||||
# define DYNLIB_HANDLE hInstance
|
||||
# define DYNLIB_LOAD( a ) LoadLibraryEx( a, NULL, LOAD_WITH_ALTERED_SEARCH_PATH )
|
||||
# define DYNLIB_GETSYM( a, b ) GetProcAddress( a, b )
|
||||
# define DYNLIB_UNLOAD( a ) !FreeLibrary( a )
|
||||
#endif
|
||||
|
||||
#ifdef CAUDIO_PLATFORM_MAC
|
||||
# define DYNLIB_HANDLE void*
|
||||
# define DYNLIB_LOAD( a ) dlopen( a, RTLD_LAZY | RTLD_GLOBAL)
|
||||
# define DYNLIB_GETSYM( a, b ) dlsym( a, b )
|
||||
# define DYNLIB_UNLOAD( a ) dlclose( a )
|
||||
# include <dlfcn.h>
|
||||
# define DYNLIB_HANDLE void*
|
||||
# define DYNLIB_LOAD( a ) dlopen( a, RTLD_LAZY | RTLD_GLOBAL)
|
||||
# define DYNLIB_GETSYM( a, b ) dlsym( a, b )
|
||||
# define DYNLIB_UNLOAD( a ) dlclose( a )
|
||||
#endif
|
||||
|
||||
#ifdef CAUDIO_PLATFORM_LINUX
|
||||
# include <dlfcn.h>
|
||||
# define DYNLIB_HANDLE void*
|
||||
# define DYNLIB_LOAD( a ) dlopen( a, RTLD_LAZY | RTLD_GLOBAL)
|
||||
# define DYNLIB_GETSYM( a, b ) dlsym( a, b )
|
||||
# define DYNLIB_UNLOAD( a ) dlclose( a )
|
||||
#endif
|
||||
|
||||
namespace cAudio
|
||||
|
@ -78,4 +72,6 @@ namespace cAudio
|
|||
};
|
||||
};
|
||||
|
||||
#endif //! CAUDIO_COMPILE_WITH_PLUGIN_SUPPORT
|
||||
|
||||
#endif //! CPLUGINMANAGER_H_INCLUDED
|
|
@ -346,11 +346,13 @@ namespace cAudio
|
|||
if(initializeDefault)
|
||||
capture->initialize();
|
||||
|
||||
#ifdef CAUDIO_COMPILE_WITH_PLUGIN_SUPPORT
|
||||
std::vector<IAudioPlugin*> plugins = cPluginManager::Instance()->getPluginList();
|
||||
for(unsigned int i = 0; i < plugins.size(); ++i)
|
||||
{
|
||||
plugins[i]->onCreateAudioCapture(capture);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CAUDIO_USE_INTERNAL_THREAD
|
||||
AudioCaptureObjectsMutex.lock();
|
||||
|
@ -378,11 +380,14 @@ namespace cAudio
|
|||
RunAudioCaptureThread = false;
|
||||
AudioCaptureObjectsMutex.unlock();
|
||||
#endif
|
||||
|
||||
#ifdef CAUDIO_COMPILE_WITH_PLUGIN_SUPPORT
|
||||
std::vector<IAudioPlugin*> plugins = cPluginManager::Instance()->getPluginList();
|
||||
for(unsigned int i = 0; i < plugins.size(); ++i)
|
||||
{
|
||||
plugins[i]->onDestoryAudioCapture(capture);
|
||||
}
|
||||
#endif
|
||||
|
||||
delete capture;
|
||||
capture = NULL;
|
||||
|
|
|
@ -743,11 +743,13 @@ namespace cAudio
|
|||
|
||||
manager->registerDataSource(&FileSourceFactory, "FileSystem", 0);
|
||||
|
||||
#ifdef CAUDIO_COMPILE_WITH_PLUGIN_SUPPORT
|
||||
std::vector<IAudioPlugin*> plugins = cPluginManager::Instance()->getPluginList();
|
||||
for(unsigned int i = 0; i < plugins.size(); ++i)
|
||||
{
|
||||
plugins[i]->onCreateAudioManager(manager);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CAUDIO_USE_INTERNAL_THREAD
|
||||
AudioManagerObjectsMutex.lock();
|
||||
|
@ -775,11 +777,14 @@ namespace cAudio
|
|||
RunAudioManagerThread = false;
|
||||
AudioManagerObjectsMutex.unlock();
|
||||
#endif
|
||||
|
||||
#ifdef CAUDIO_COMPILE_WITH_PLUGIN_SUPPORT
|
||||
std::vector<IAudioPlugin*> plugins = cPluginManager::Instance()->getPluginList();
|
||||
for(unsigned int i = 0; i < plugins.size(); ++i)
|
||||
{
|
||||
plugins[i]->onDestroyAudioManager(manager);
|
||||
}
|
||||
#endif
|
||||
|
||||
manager->unRegisterAllAudioDecoders();
|
||||
manager->unRegisterAllDataSources();
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#include "../include/cAudioDefines.h"
|
||||
#include "../include/ILogger.h"
|
||||
|
||||
#ifdef CAUDIO_COMPILE_WITH_PLUGIN_SUPPORT
|
||||
|
||||
namespace cAudio
|
||||
{
|
||||
|
||||
|
@ -162,4 +164,6 @@ CAUDIO_API IPluginManager* getPluginManager()
|
|||
return cPluginManager::Instance();
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
#endif //! CAUDIO_COMPILE_WITH_PLUGIN_SUPPORT
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
#define IPLUGINMANAGER_H_INCLUDED
|
||||
|
||||
#include "IAudioPlugin.h"
|
||||
#include "cAudioDefines.h"
|
||||
|
||||
#ifdef CAUDIO_COMPILE_WITH_PLUGIN_SUPPORT
|
||||
namespace cAudio
|
||||
{
|
||||
//! Interface for the plugin capabilities of cAudio.
|
||||
|
@ -58,4 +60,6 @@ namespace cAudio
|
|||
CAUDIO_API IPluginManager* getPluginManager();
|
||||
};
|
||||
|
||||
#endif //! CAUDIO_COMPILE_WITH_PLUGIN_SUPPORT
|
||||
|
||||
#endif //! IPLUGINMANAGER_H_INCLUDED
|
|
@ -31,6 +31,9 @@
|
|||
//! This define controls whether the RIFF/Wav decoder is compiled into the library.
|
||||
#define CAUDIO_COMPILE_WITH_WAV_DECODER
|
||||
|
||||
//! This define controls whether plugin support is added into the library, commenting it out will prevent any plugins from working
|
||||
#define CAUDIO_COMPILE_WITH_PLUGIN_SUPPORT
|
||||
|
||||
//! Size of the internal buffer per source for audio data (total amount buffered is CAUDIO_SOURCE_BUFFER_SIZE * CAUDIO_SOURCE_NUM_BUFFERS)
|
||||
#define CAUDIO_SOURCE_BUFFER_SIZE ( 1024 * 64 )
|
||||
//! Number of internal buffers to cycle through per source (Note: using only 1 leads to choppy sound or premature ending of sources)
|
||||
|
@ -64,6 +67,9 @@
|
|||
//! This define controls whether the RIFF/Wav decoder is compiled into the library.
|
||||
#define CAUDIO_COMPILE_WITH_WAV_DECODER
|
||||
|
||||
//! This define controls whether plugin support is added into the library, commenting it out will prevent any plugins from working
|
||||
#define CAUDIO_COMPILE_WITH_PLUGIN_SUPPORT
|
||||
|
||||
//! Size of the internal buffer per source for audio data (total amount buffered is CAUDIO_SOURCE_BUFFER_SIZE * CAUDIO_SOURCE_NUM_BUFFERS)
|
||||
#define CAUDIO_SOURCE_BUFFER_SIZE ( 1024 * 64 )
|
||||
//! Number of internal buffers to cycle through per source (Note: using only 1 leads to choppy sound or premature ending of sources)
|
||||
|
@ -124,6 +130,9 @@
|
|||
//! This define controls whether the RIFF/Wav decoder is compiled into the library.
|
||||
#define CAUDIO_COMPILE_WITH_WAV_DECODER
|
||||
|
||||
//! This define controls whether plugin support is added into the library, commenting it out will prevent any plugins from working
|
||||
#define CAUDIO_COMPILE_WITH_PLUGIN_SUPPORT
|
||||
|
||||
//! Size of the internal buffer per source for audio data (total amount buffered is CAUDIO_SOURCE_BUFFER_SIZE * CAUDIO_SOURCE_NUM_BUFFERS)
|
||||
#define CAUDIO_SOURCE_BUFFER_SIZE ( 1024 * 64 )
|
||||
//! Number of internal buffers to cycle through per source (Note: using only 1 leads to choppy sound or premature ending of sources)
|
||||
|
|
Loading…
Reference in New Issue