Changes to STL containers to use typedefs, allowing rerouting of allocations to be disabled on platforms that may not support it (gcc 4.2).
This commit is contained in:
parent
f7bbd9f0f9
commit
ff7b993ab0
|
@ -6,12 +6,9 @@
|
|||
#define CAUDIOCAPTURE_H
|
||||
|
||||
#include "../include/IAudioCapture.h"
|
||||
#include <vector>
|
||||
#include <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
#include "../Headers/cMutex.h"
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include "../Headers/cMemoryOverride.h"
|
||||
#include "../Headers/cSTLAllocator.h"
|
||||
|
||||
|
@ -79,16 +76,16 @@ namespace cAudio
|
|||
unsigned int InternalBufferSize;
|
||||
int SampleSize;
|
||||
|
||||
std::vector<char, cSTLAllocator<char> > CaptureBuffer;
|
||||
std::vector<std::string, cSTLAllocator<std::string> > AvailableDevices;
|
||||
std::string DefaultDevice;
|
||||
std::list<ICaptureEventHandler*, cSTLAllocator<ICaptureEventHandler*> > eventHandlerList;
|
||||
cAudioVector<char>::Type CaptureBuffer;
|
||||
cAudioVector<cAudioString>::Type AvailableDevices;
|
||||
cAudioString DefaultDevice;
|
||||
cAudioList<ICaptureEventHandler*>::Type eventHandlerList;
|
||||
|
||||
bool Supported;
|
||||
bool Ready;
|
||||
bool Capturing;
|
||||
|
||||
std::string DeviceName;
|
||||
cAudioString DeviceName;
|
||||
ALCdevice* CaptureDevice;
|
||||
|
||||
bool checkError();
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "../include/IAudioEffects.h"
|
||||
#include "../Headers/cMutex.h"
|
||||
#include "../Headers/cEFXFunctions.h"
|
||||
#include <map>
|
||||
#include "../Headers/cSTLAllocator.h"
|
||||
|
||||
#ifdef CAUDIO_EFX_ENABLED
|
||||
|
@ -70,19 +69,19 @@ namespace cAudio
|
|||
bool SupportedEffects[EET_COUNT];
|
||||
bool SupportedFilters[EFT_COUNT];
|
||||
|
||||
std::map<std::string, sEAXReverbParameters, std::less<std::string>, cSTLAllocator<std::pair<std::string, sEAXReverbParameters>> > EAXReverbPresets;
|
||||
std::map<std::string, sReverbParameters, std::less<std::string>, cSTLAllocator<std::pair<std::string, sReverbParameters>> > ReverbPresets;
|
||||
std::map<std::string, sChorusParameters, std::less<std::string>, cSTLAllocator<std::pair<std::string, sChorusParameters>> > ChorusPresets;
|
||||
std::map<std::string, sDistortionParameters, std::less<std::string>, cSTLAllocator<std::pair<std::string, sDistortionParameters>> > DistortionPresets;
|
||||
std::map<std::string, sEchoParameters, std::less<std::string>, cSTLAllocator<std::pair<std::string, sEchoParameters>> > EchoPresets;
|
||||
std::map<std::string, sFlangerParameters, std::less<std::string>, cSTLAllocator<std::pair<std::string, sFlangerParameters>> > FlangerPresets;
|
||||
std::map<std::string, sFrequencyShiftParameters, std::less<std::string>, cSTLAllocator<std::pair<std::string, sFrequencyShiftParameters>> > FrequencyShiftPresets;
|
||||
std::map<std::string, sVocalMorpherParameters, std::less<std::string>, cSTLAllocator<std::pair<std::string, sVocalMorpherParameters>> > VocalMorpherPresets;
|
||||
std::map<std::string, sPitchShifterParameters, std::less<std::string>, cSTLAllocator<std::pair<std::string, sPitchShifterParameters>> > PitchShifterPresets;
|
||||
std::map<std::string, sRingModulatorParameters, std::less<std::string>, cSTLAllocator<std::pair<std::string, sRingModulatorParameters>> > RingModulatorPresets;
|
||||
std::map<std::string, sAutowahParameters, std::less<std::string>, cSTLAllocator<std::pair<std::string, sAutowahParameters>> > AutowahPresets;
|
||||
std::map<std::string, sCompressorParameters, std::less<std::string>, cSTLAllocator<std::pair<std::string, sCompressorParameters>> > CompressorPresets;
|
||||
std::map<std::string, sEqualizerParameters, std::less<std::string>, cSTLAllocator<std::pair<std::string, sEqualizerParameters>> > EqualizerPresets;
|
||||
cAudioMap<cAudioString, sEAXReverbParameters>::Type EAXReverbPresets;
|
||||
cAudioMap<cAudioString, sReverbParameters>::Type ReverbPresets;
|
||||
cAudioMap<cAudioString, sChorusParameters>::Type ChorusPresets;
|
||||
cAudioMap<cAudioString, sDistortionParameters>::Type DistortionPresets;
|
||||
cAudioMap<cAudioString, sEchoParameters>::Type EchoPresets;
|
||||
cAudioMap<cAudioString, sFlangerParameters>::Type FlangerPresets;
|
||||
cAudioMap<cAudioString, sFrequencyShiftParameters>::Type FrequencyShiftPresets;
|
||||
cAudioMap<cAudioString, sVocalMorpherParameters>::Type VocalMorpherPresets;
|
||||
cAudioMap<cAudioString, sPitchShifterParameters>::Type PitchShifterPresets;
|
||||
cAudioMap<cAudioString, sRingModulatorParameters>::Type RingModulatorPresets;
|
||||
cAudioMap<cAudioString, sAutowahParameters>::Type AutowahPresets;
|
||||
cAudioMap<cAudioString, sCompressorParameters>::Type CompressorPresets;
|
||||
cAudioMap<cAudioString, sEqualizerParameters>::Type EqualizerPresets;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -5,10 +5,6 @@
|
|||
#ifndef CAUDIOMANAGER_H_INCLUDED
|
||||
#define CAUDIOMANAGER_H_INCLUDED
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "cAudioSource.h"
|
||||
#include "../include/IAudioDecoderFactory.h"
|
||||
#include "cListener.h"
|
||||
|
@ -100,17 +96,17 @@ namespace cAudio
|
|||
bool Initialized;
|
||||
|
||||
//! Holds an index for fast searching of audio sources by name
|
||||
std::map<std::string, IAudioSource*, std::less<std::string>, cSTLAllocator<std::pair<std::string, IAudioSource*> > > audioIndex;
|
||||
typedef std::map<std::string, IAudioSource*, std::less<std::string>, cSTLAllocator<std::pair<std::string, IAudioSource*> > >::iterator audioIndexIterator;
|
||||
cAudioMap<cAudioString, IAudioSource*>::Type audioIndex;
|
||||
typedef cAudioMap<cAudioString, IAudioSource*>::Type::iterator audioIndexIterator;
|
||||
//! Holds all managed audio sources
|
||||
std::vector<IAudioSource*, cSTLAllocator<IAudioSource*> > audioSources;
|
||||
cAudioVector<IAudioSource*>::Type audioSources;
|
||||
//! Decoder map that holds all decoders by file extension
|
||||
std::map<std::string, IAudioDecoderFactory*, std::less<std::string>, cSTLAllocator<std::pair<std::string, IAudioDecoderFactory*> > > decodermap;
|
||||
typedef std::map<std::string, IAudioDecoderFactory*, std::less<std::string>, cSTLAllocator<std::pair<std::string, IAudioDecoderFactory*> > >::iterator decodermapIterator;
|
||||
cAudioMap<cAudioString, IAudioDecoderFactory*>::Type decodermap;
|
||||
typedef cAudioMap<cAudioString, IAudioDecoderFactory*>::Type::iterator decodermapIterator;
|
||||
//! Archive map that holds all datasource types
|
||||
std::map<std::string, IDataSourceFactory*, std::less<std::string>, cSTLAllocator<std::pair<std::string, IDataSourceFactory*> > > datasourcemap;
|
||||
typedef std::map<std::string, IDataSourceFactory*, std::less<std::string>, cSTLAllocator<std::pair<std::string, IDataSourceFactory*> > >::iterator datasourcemapIterator;
|
||||
std::vector< std::pair<int, std::string>, cSTLAllocator<std::pair<int, std::string> > > dataSourcePriorityList;
|
||||
cAudioMap<cAudioString, IDataSourceFactory*>::Type datasourcemap;
|
||||
typedef cAudioMap<cAudioString, IDataSourceFactory*>::Type::iterator datasourcemapIterator;
|
||||
cAudioVector< std::pair<int, cAudioString> >::Type dataSourcePriorityList;
|
||||
|
||||
//! The listener object
|
||||
cListener initlistener;
|
||||
|
@ -121,14 +117,14 @@ namespace cAudio
|
|||
//! Check for OpenAL errors
|
||||
bool checkError();
|
||||
|
||||
std::vector<std::string, cSTLAllocator<std::string> > AvailableDevices;
|
||||
std::string DefaultDevice;
|
||||
cAudioVector<cAudioString>::Type AvailableDevices;
|
||||
cAudioString DefaultDevice;
|
||||
|
||||
//! Signals a event to all event handlers
|
||||
void signalEvent(Events sevent);
|
||||
|
||||
//! List of all attached event handlers
|
||||
std::list<IManagerEventHandler*, cSTLAllocator<IManagerEventHandler*> > eventHandlerList;
|
||||
cAudioList<IManagerEventHandler*>::Type eventHandlerList;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ namespace cAudio
|
|||
bool Valid;
|
||||
|
||||
//! List of registered event handlers
|
||||
std::list<ISourceEventHandler*, cSTLAllocator<ISourceEventHandler*> > eventHandlerList;
|
||||
cAudioList<ISourceEventHandler*>::Type eventHandlerList;
|
||||
|
||||
#ifdef CAUDIO_EFX_ENABLED
|
||||
//! Holds pointers to all the EFX related functions
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
#ifndef CLOGGER_H_INCLUDED
|
||||
#define CLOGGER_H_INCLUDED
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "../include/ILogger.h"
|
||||
|
@ -42,8 +40,8 @@ namespace cAudio
|
|||
unsigned long StartTime;
|
||||
char TempTextBuf[2048];
|
||||
LogLevel MinLogLevel;
|
||||
std::map<std::string, ILogReceiver*, std::less<std::string>, cSTLAllocator<std::pair<std::string, ILogReceiver*> > > Receivers;
|
||||
typedef std::map<std::string, ILogReceiver*, std::less<std::string>, cSTLAllocator<std::pair<std::string, ILogReceiver*> > >::iterator ReceiversIterator;
|
||||
cAudioMap<cAudioString, ILogReceiver*>::Type Receivers;
|
||||
typedef cAudioMap<cAudioString, ILogReceiver*>::Type::iterator ReceiversIterator;
|
||||
private:
|
||||
};
|
||||
};
|
||||
|
|
|
@ -4,18 +4,6 @@
|
|||
#include <new>
|
||||
#include "../include/cAudioMemory.h"
|
||||
|
||||
#ifdef CAUDIO_DEBUG
|
||||
#define CAUDIO_NEW new (__FILE__, __LINE__, __FUNCTION__)
|
||||
#define CAUDIO_DELETE delete
|
||||
#define CAUDIO_MALLOC(size) cAudio::getMemoryProvider()->Allocate(size, __FILE__, __LINE__, __FUNCTION__)
|
||||
#define CAUDIO_FREE(pointer) cAudio::getMemoryProvider()->Free((void*)pointer)
|
||||
#else
|
||||
#define CAUDIO_NEW new
|
||||
#define CAUDIO_DELETE delete
|
||||
#define CAUDIO_MALLOC(size) cAudio::getMemoryProvider()->Allocate(size, NULL, -1, NULL)
|
||||
#define CAUDIO_FREE(pointer) cAudio::getMemoryProvider()->Free((void*)pointer)
|
||||
#endif
|
||||
|
||||
namespace cAudio
|
||||
{
|
||||
class cMemoryOverride
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
#ifndef CPLUGINMANAGER_H_INCLUDED
|
||||
#define CPLUGINMANAGER_H_INCLUDED
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include "../include/IPluginManager.h"
|
||||
#include "../include/IAudioPlugin.h"
|
||||
#include "../Headers/cMutex.h"
|
||||
|
@ -65,7 +61,7 @@ namespace cAudio
|
|||
virtual bool checkForPlugin(const char* name);
|
||||
virtual IAudioPlugin* getPlugin(const char* name);
|
||||
virtual unsigned int getPluginCount();
|
||||
std::vector<IAudioPlugin*> getPluginList();
|
||||
cAudioVector<IAudioPlugin*>::Type getPluginList();
|
||||
|
||||
virtual void uninstallPlugin(IAudioPlugin* plugin);
|
||||
virtual void uninstallPlugin(const char* name);
|
||||
|
@ -74,11 +70,11 @@ namespace cAudio
|
|||
void autoLoadPlugins();
|
||||
#endif
|
||||
protected:
|
||||
std::map<std::string, IAudioPlugin*, std::less<std::string>, cSTLAllocator<std::pair<std::string, IAudioPlugin*> > > RegisteredPlugins;
|
||||
typedef std::map<std::string, IAudioPlugin*, std::less<std::string>, cSTLAllocator<std::pair<std::string, IAudioPlugin*> > >::iterator RegisteredPluginsIterator;
|
||||
cAudioMap<cAudioString, IAudioPlugin*>::Type RegisteredPlugins;
|
||||
typedef cAudioMap<cAudioString, IAudioPlugin*>::Type::iterator RegisteredPluginsIterator;
|
||||
#ifdef CAUDIO_COMPILE_WITH_DYNAMIC_PLUGIN_SUPPORT
|
||||
std::map<IAudioPlugin*, DYNLIB_HANDLE, std::less<IAudioPlugin*>, cSTLAllocator<std::pair<IAudioPlugin*, DYNLIB_HANDLE> > > DynamicallyLoadedPlugins;
|
||||
typedef std::map<IAudioPlugin*, DYNLIB_HANDLE, std::less<IAudioPlugin*>, cSTLAllocator<std::pair<IAudioPlugin*, DYNLIB_HANDLE> > >::iterator DynamicallyLoadedPluginsIterator;
|
||||
cAudioMap<IAudioPlugin*, DYNLIB_HANDLE>::Type DynamicallyLoadedPlugins;
|
||||
typedef cAudioMap<IAudioPlugin*, DYNLIB_HANDLE>::Type::iterator DynamicallyLoadedPluginsIterator;
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
|
|
@ -2,33 +2,27 @@
|
|||
#define CSTLALLOCATOR_H_INCLUDED
|
||||
|
||||
#include "../include/cAudioDefines.h"
|
||||
#include "../Headers/cMemoryOverride.h"
|
||||
#include "../include/cAudioMemory.h"
|
||||
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace cAudio
|
||||
{
|
||||
template<typename T>
|
||||
struct cSTLAllocatorBase
|
||||
{ // base class for generic allocators
|
||||
typedef T value_type;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct cSTLAllocatorBase<const T>
|
||||
{ // base class for generic allocators for const T
|
||||
typedef T value_type;
|
||||
};
|
||||
|
||||
template <typename T> class cSTLAllocator : public cSTLAllocatorBase<T>
|
||||
#ifdef CAUDIO_REROUTE_STL_ALLOCATIONS
|
||||
template <typename T> class cSTLAllocator
|
||||
{
|
||||
public:
|
||||
typedef cSTLAllocatorBase<T> Base;
|
||||
typedef typename Base::value_type value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
typedef std::size_t size_type;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef T value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
typedef std::size_t size_type;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
|
||||
template<typename U>
|
||||
struct rebind
|
||||
|
@ -59,7 +53,7 @@ namespace cAudio
|
|||
return &x;
|
||||
}
|
||||
|
||||
inline pointer allocate( size_type count, typename std::allocator<void>::const_pointer ptr = 0 )
|
||||
pointer allocate( size_type count, typename std::allocator<void>::const_pointer ptr = 0 )
|
||||
{
|
||||
(void)ptr;
|
||||
register size_type size = count*sizeof( T );
|
||||
|
@ -67,7 +61,7 @@ namespace cAudio
|
|||
return p;
|
||||
}
|
||||
|
||||
inline void deallocate( pointer p, size_type size )
|
||||
void deallocate( pointer p, size_type size )
|
||||
{
|
||||
CAUDIO_FREE(p);
|
||||
}
|
||||
|
@ -116,6 +110,21 @@ namespace cAudio
|
|||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CAUDIO_REROUTE_STL_ALLOCATIONS
|
||||
typedef std::basic_string< char, std::char_traits<char>, cSTLAllocator<char> > cAudioString;
|
||||
template<typename T1, typename T2> struct cAudioMap { typedef std::map< T1, T2, std::less< T1 >, cSTLAllocator< std::pair< T1, T2 > > > Type; };
|
||||
template<typename T> struct cAudioSet { typedef std::set< T, std::less< T >, cSTLAllocator< T > > Type; };
|
||||
template<typename T> struct cAudioList { typedef std::list< T, cSTLAllocator< T > > Type; };
|
||||
template<typename T> struct cAudioVector { typedef std::vector< T, cSTLAllocator< T > > Type; };
|
||||
#else
|
||||
typedef std::string cAudioString;
|
||||
template<typename T1, typename T2> struct cAudioMap { typedef std::map< T1, T2> Type; };
|
||||
template<typename T> struct cAudioSet { typedef std::set< T > Type; };
|
||||
template<typename T> struct cAudioList { typedef std::list< T > Type; };
|
||||
template<typename T> struct cAudioVector { typedef std::vector< T > Type; };
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
#ifndef CUTILS_H_INCLUDED
|
||||
#define CUTILS_H_INCLUDED
|
||||
#include "../include/cAudioPlatform.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "../Headers/cSTLAllocator.h"
|
||||
|
||||
#ifdef CAUDIO_PLATFORM_WIN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
|
@ -21,26 +20,29 @@
|
|||
# include <cstring>
|
||||
#endif
|
||||
|
||||
//! Grabs the current extention of a given string.
|
||||
static std::string getExt(const std::string& filename)
|
||||
namespace cAudio
|
||||
{
|
||||
if(filename.find_last_of(".") == std::string::npos) return filename;
|
||||
|
||||
//! Grabs the current extention of a given string.
|
||||
static cAudioString getExt(const cAudioString& filename)
|
||||
{
|
||||
if(filename.find_last_of(".") == cAudioString::npos) return filename;
|
||||
return filename.substr(filename.find_last_of(".") + 1, filename.length()-filename.find_last_of(".")-1);
|
||||
}
|
||||
|
||||
//! Prevents a bug with NULL passed into std::string.
|
||||
static std::string safeCStr(const char* str)
|
||||
//! Prevents a bug with NULL passed into cAudioString.
|
||||
static cAudioString safeCStr(const char* str)
|
||||
{
|
||||
if( str != NULL ) return std::string(str);
|
||||
else return std::string("");
|
||||
if( str != NULL ) return cAudioString(str);
|
||||
else return cAudioString("");
|
||||
}
|
||||
|
||||
//! Returns a list of files/directories in the supplied directory. Used internally for auto-installation of plugins.
|
||||
static std::vector<std::string> getFilesInDirectory(std::string path)
|
||||
static cAudioVector<cAudioString>::Type getFilesInDirectory(cAudioString path)
|
||||
{
|
||||
std::vector<std::string> FileList;
|
||||
cAudioVector<cAudioString>::Type FileList;
|
||||
#ifdef CAUDIO_PLATFORM_WIN
|
||||
std::string search = path + "\\" + std::string("*.*");
|
||||
cAudioString search = path + "\\" + cAudioString("*.*");
|
||||
WIN32_FIND_DATA info;
|
||||
HANDLE h = FindFirstFile(search.c_str(), &info);
|
||||
if (h != INVALID_HANDLE_VALUE)
|
||||
|
@ -76,4 +78,6 @@ static std::vector<std::string> getFilesInDirectory(std::string path)
|
|||
return FileList;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //! CUTILS_H_INCLUDED
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "../Headers/cPluginManager.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <set>
|
||||
|
||||
namespace cAudio
|
||||
{
|
||||
|
@ -19,14 +18,14 @@ namespace cAudio
|
|||
//Note: OpenAL is threadsafe, so a mutex only needs to protect the class state
|
||||
#ifdef CAUDIO_USE_INTERNAL_THREAD
|
||||
static cAudioMutex AudioCaptureObjectsMutex;
|
||||
static std::set<IAudioCapture*, std::less<IAudioCapture*>, cSTLAllocator<IAudioCapture*> > AudioCaptureObjects;
|
||||
static cAudioSet<IAudioCapture*>::Type AudioCaptureObjects;
|
||||
|
||||
CAUDIO_DECLARE_THREAD_FUNCTION(AudioCaptureUpdateThread)
|
||||
{
|
||||
while(RunAudioCaptureThread)
|
||||
{
|
||||
AudioCaptureObjectsMutex.lock();
|
||||
std::set<IAudioCapture*, std::less<IAudioCapture*>, cSTLAllocator<IAudioCapture*> >::iterator it;
|
||||
cAudioSet<IAudioCapture*>::Type::iterator it;
|
||||
for ( it=AudioCaptureObjects.begin() ; it != AudioCaptureObjects.end(); it++ )
|
||||
{
|
||||
(*it)->updateCaptureBuffer();
|
||||
|
@ -122,7 +121,7 @@ namespace cAudio
|
|||
{
|
||||
while(*deviceList)
|
||||
{
|
||||
std::string device(deviceList);
|
||||
cAudioString device(deviceList);
|
||||
AvailableDevices.push_back(device);
|
||||
deviceList += strlen(deviceList) + 1;
|
||||
}
|
||||
|
@ -347,7 +346,7 @@ namespace cAudio
|
|||
capture->initialize();
|
||||
|
||||
#ifdef CAUDIO_COMPILE_WITH_PLUGIN_SUPPORT
|
||||
std::vector<IAudioPlugin*> plugins = cPluginManager::Instance()->getPluginList();
|
||||
cAudioVector<IAudioPlugin*>::Type plugins = cPluginManager::Instance()->getPluginList();
|
||||
for(unsigned int i = 0; i < plugins.size(); ++i)
|
||||
{
|
||||
plugins[i]->onCreateAudioCapture(capture);
|
||||
|
@ -382,7 +381,7 @@ namespace cAudio
|
|||
#endif
|
||||
|
||||
#ifdef CAUDIO_COMPILE_WITH_PLUGIN_SUPPORT
|
||||
std::vector<IAudioPlugin*> plugins = cPluginManager::Instance()->getPluginList();
|
||||
cAudioVector<IAudioPlugin*>::Type plugins = cPluginManager::Instance()->getPluginList();
|
||||
for(unsigned int i = 0; i < plugins.size(); ++i)
|
||||
{
|
||||
plugins[i]->onDestoryAudioCapture(capture);
|
||||
|
@ -424,7 +423,7 @@ namespace cAudio
|
|||
void cAudioCapture::signalEvent(Events sevent)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::list<ICaptureEventHandler*, cSTLAllocator<ICaptureEventHandler*> >::iterator it = eventHandlerList.begin();
|
||||
cAudioList<ICaptureEventHandler*>::Type::iterator it = eventHandlerList.begin();
|
||||
|
||||
if(it != eventHandlerList.end()){
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ bool cAudioEffects::isFilterSupported(const FilterTypes& type) const
|
|||
bool cAudioEffects::addEAXReverbEffectPreset(const char* name, const sEAXReverbParameters& setting)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
EAXReverbPresets[safeName] = setting;
|
||||
return true;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ bool cAudioEffects::addEAXReverbEffectPreset(const char* name, const sEAXReverbP
|
|||
bool cAudioEffects::addReverbEffectPreset(const char* name, const sReverbParameters& setting)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
ReverbPresets[safeName] = setting;
|
||||
return true;
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ bool cAudioEffects::addReverbEffectPreset(const char* name, const sReverbParamet
|
|||
bool cAudioEffects::addChorusEffectPreset(const char* name, const sChorusParameters& setting)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
ChorusPresets[safeName] = setting;
|
||||
return true;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ bool cAudioEffects::addChorusEffectPreset(const char* name, const sChorusParamet
|
|||
bool cAudioEffects::addDistortionEffectPreset(const char* name, const sDistortionParameters& setting)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
DistortionPresets[safeName] = setting;
|
||||
return true;
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ bool cAudioEffects::addDistortionEffectPreset(const char* name, const sDistortio
|
|||
bool cAudioEffects::addEchoEffectPreset(const char* name, const sEchoParameters& setting)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
EchoPresets[safeName] = setting;
|
||||
return true;
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ bool cAudioEffects::addEchoEffectPreset(const char* name, const sEchoParameters&
|
|||
bool cAudioEffects::addFlangerEffectPreset(const char* name, const sFlangerParameters& setting)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
FlangerPresets[safeName] = setting;
|
||||
return true;
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ bool cAudioEffects::addFlangerEffectPreset(const char* name, const sFlangerParam
|
|||
bool cAudioEffects::addFrequencyShiftEffectPreset(const char* name, const sFrequencyShiftParameters& setting)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
FrequencyShiftPresets[safeName] = setting;
|
||||
return true;
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ bool cAudioEffects::addFrequencyShiftEffectPreset(const char* name, const sFrequ
|
|||
bool cAudioEffects::addVocalMorpherEffectPreset(const char* name, const sVocalMorpherParameters& setting)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
VocalMorpherPresets[safeName] = setting;
|
||||
return true;
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ bool cAudioEffects::addVocalMorpherEffectPreset(const char* name, const sVocalMo
|
|||
bool cAudioEffects::addPitchShifterEffectPreset(const char* name, const sPitchShifterParameters& setting)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
PitchShifterPresets[safeName] = setting;
|
||||
return true;
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ bool cAudioEffects::addPitchShifterEffectPreset(const char* name, const sPitchSh
|
|||
bool cAudioEffects::addRingModulatorEffectPreset(const char* name, const sRingModulatorParameters& setting)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
RingModulatorPresets[safeName] = setting;
|
||||
return true;
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ bool cAudioEffects::addRingModulatorEffectPreset(const char* name, const sRingMo
|
|||
bool cAudioEffects::addAutowahEffectPreset(const char* name, const sAutowahParameters& setting)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
AutowahPresets[safeName] = setting;
|
||||
return true;
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ bool cAudioEffects::addAutowahEffectPreset(const char* name, const sAutowahParam
|
|||
bool cAudioEffects::addCompressorEffectPreset(const char* name, const sCompressorParameters& setting)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
CompressorPresets[safeName] = setting;
|
||||
return true;
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ bool cAudioEffects::addCompressorEffectPreset(const char* name, const sCompresso
|
|||
bool cAudioEffects::addEqualizerEffectPreset(const char* name, const sEqualizerParameters& setting)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
EqualizerPresets[safeName] = setting;
|
||||
return true;
|
||||
}
|
||||
|
@ -173,8 +173,8 @@ bool cAudioEffects::addEqualizerEffectPreset(const char* name, const sEqualizerP
|
|||
sEAXReverbParameters cAudioEffects::getEAXReverbEffectPreset(const char* name)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
std::map<std::string, sEAXReverbParameters, std::less<std::string>, cSTLAllocator<std::pair<std::string, sEAXReverbParameters>> >::iterator it = EAXReverbPresets.find(safeName);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
cAudioMap<cAudioString, sEAXReverbParameters>::Type::iterator it = EAXReverbPresets.find(safeName);
|
||||
if(it != EAXReverbPresets.end())
|
||||
{
|
||||
return it->second;
|
||||
|
@ -185,8 +185,8 @@ sEAXReverbParameters cAudioEffects::getEAXReverbEffectPreset(const char* name)
|
|||
sReverbParameters cAudioEffects::getReverbEffectPreset(const char* name)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
std::map<std::string, sReverbParameters, std::less<std::string>, cSTLAllocator<std::pair<std::string, sReverbParameters>> >::iterator it = ReverbPresets.find(safeName);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
cAudioMap<cAudioString, sReverbParameters>::Type::iterator it = ReverbPresets.find(safeName);
|
||||
if(it != ReverbPresets.end())
|
||||
{
|
||||
return it->second;
|
||||
|
@ -197,8 +197,8 @@ sReverbParameters cAudioEffects::getReverbEffectPreset(const char* name)
|
|||
sChorusParameters cAudioEffects::getChorusEffectPreset(const char* name)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
std::map<std::string, sChorusParameters, std::less<std::string>, cSTLAllocator<std::pair<std::string, sChorusParameters>> >::iterator it = ChorusPresets.find(safeName);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
cAudioMap<cAudioString, sChorusParameters>::Type::iterator it = ChorusPresets.find(safeName);
|
||||
if(it != ChorusPresets.end())
|
||||
{
|
||||
return it->second;
|
||||
|
@ -209,8 +209,8 @@ sChorusParameters cAudioEffects::getChorusEffectPreset(const char* name)
|
|||
sDistortionParameters cAudioEffects::getDistortionEffectPreset(const char* name)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
std::map<std::string, sDistortionParameters, std::less<std::string>, cSTLAllocator<std::pair<std::string, sDistortionParameters>> >::iterator it = DistortionPresets.find(safeName);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
cAudioMap<cAudioString, sDistortionParameters>::Type::iterator it = DistortionPresets.find(safeName);
|
||||
if(it != DistortionPresets.end())
|
||||
{
|
||||
return it->second;
|
||||
|
@ -221,8 +221,8 @@ sDistortionParameters cAudioEffects::getDistortionEffectPreset(const char* name)
|
|||
sEchoParameters cAudioEffects::getEchoEffectPreset(const char* name)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
std::map<std::string, sEchoParameters, std::less<std::string>, cSTLAllocator<std::pair<std::string, sEchoParameters>> >::iterator it = EchoPresets.find(safeName);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
cAudioMap<cAudioString, sEchoParameters>::Type::iterator it = EchoPresets.find(safeName);
|
||||
if(it != EchoPresets.end())
|
||||
{
|
||||
return it->second;
|
||||
|
@ -233,8 +233,8 @@ sEchoParameters cAudioEffects::getEchoEffectPreset(const char* name)
|
|||
sFlangerParameters cAudioEffects::getFlangerEffectPreset(const char* name)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
std::map<std::string, sFlangerParameters, std::less<std::string>, cSTLAllocator<std::pair<std::string, sFlangerParameters>> >::iterator it = FlangerPresets.find(safeName);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
cAudioMap<cAudioString, sFlangerParameters>::Type::iterator it = FlangerPresets.find(safeName);
|
||||
if(it != FlangerPresets.end())
|
||||
{
|
||||
return it->second;
|
||||
|
@ -245,8 +245,8 @@ sFlangerParameters cAudioEffects::getFlangerEffectPreset(const char* name)
|
|||
sFrequencyShiftParameters cAudioEffects::getFrequencyShiftEffectPreset(const char* name)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
std::map<std::string, sFrequencyShiftParameters, std::less<std::string>, cSTLAllocator<std::pair<std::string, sFrequencyShiftParameters>> >::iterator it = FrequencyShiftPresets.find(safeName);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
cAudioMap<cAudioString, sFrequencyShiftParameters>::Type::iterator it = FrequencyShiftPresets.find(safeName);
|
||||
if(it != FrequencyShiftPresets.end())
|
||||
{
|
||||
return it->second;
|
||||
|
@ -257,8 +257,8 @@ sFrequencyShiftParameters cAudioEffects::getFrequencyShiftEffectPreset(const cha
|
|||
sVocalMorpherParameters cAudioEffects::getVocalMorpherEffectPreset(const char* name)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
std::map<std::string, sVocalMorpherParameters, std::less<std::string>, cSTLAllocator<std::pair<std::string, sVocalMorpherParameters>> >::iterator it = VocalMorpherPresets.find(safeName);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
cAudioMap<cAudioString, sVocalMorpherParameters>::Type::iterator it = VocalMorpherPresets.find(safeName);
|
||||
if(it != VocalMorpherPresets.end())
|
||||
{
|
||||
return it->second;
|
||||
|
@ -269,8 +269,8 @@ sVocalMorpherParameters cAudioEffects::getVocalMorpherEffectPreset(const char* n
|
|||
sPitchShifterParameters cAudioEffects::getPitchShifterEffectPreset(const char* name)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
std::map<std::string, sPitchShifterParameters, std::less<std::string>, cSTLAllocator<std::pair<std::string, sPitchShifterParameters>> >::iterator it = PitchShifterPresets.find(safeName);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
cAudioMap<cAudioString, sPitchShifterParameters>::Type::iterator it = PitchShifterPresets.find(safeName);
|
||||
if(it != PitchShifterPresets.end())
|
||||
{
|
||||
return it->second;
|
||||
|
@ -281,8 +281,8 @@ sPitchShifterParameters cAudioEffects::getPitchShifterEffectPreset(const char* n
|
|||
sRingModulatorParameters cAudioEffects::getRingModulatorEffectPreset(const char* name)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
std::map<std::string, sRingModulatorParameters, std::less<std::string>, cSTLAllocator<std::pair<std::string, sRingModulatorParameters>> >::iterator it = RingModulatorPresets.find(safeName);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
cAudioMap<cAudioString, sRingModulatorParameters>::Type::iterator it = RingModulatorPresets.find(safeName);
|
||||
if(it != RingModulatorPresets.end())
|
||||
{
|
||||
return it->second;
|
||||
|
@ -293,8 +293,8 @@ sRingModulatorParameters cAudioEffects::getRingModulatorEffectPreset(const char*
|
|||
sAutowahParameters cAudioEffects::getAutowahEffectPreset(const char* name)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
std::map<std::string, sAutowahParameters, std::less<std::string>, cSTLAllocator<std::pair<std::string, sAutowahParameters>> >::iterator it = AutowahPresets.find(safeName);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
cAudioMap<cAudioString, sAutowahParameters>::Type::iterator it = AutowahPresets.find(safeName);
|
||||
if(it != AutowahPresets.end())
|
||||
{
|
||||
return it->second;
|
||||
|
@ -305,8 +305,8 @@ sAutowahParameters cAudioEffects::getAutowahEffectPreset(const char* name)
|
|||
sCompressorParameters cAudioEffects::getCompressorEffectPreset(const char* name)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
std::map<std::string, sCompressorParameters, std::less<std::string>, cSTLAllocator<std::pair<std::string, sCompressorParameters>> >::iterator it = CompressorPresets.find(safeName);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
cAudioMap<cAudioString, sCompressorParameters>::Type::iterator it = CompressorPresets.find(safeName);
|
||||
if(it != CompressorPresets.end())
|
||||
{
|
||||
return it->second;
|
||||
|
@ -317,8 +317,8 @@ sCompressorParameters cAudioEffects::getCompressorEffectPreset(const char* name)
|
|||
sEqualizerParameters cAudioEffects::getEqualizerEffectPreset(const char* name)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
std::map<std::string, sEqualizerParameters, std::less<std::string>, cSTLAllocator<std::pair<std::string, sEqualizerParameters>> >::iterator it = EqualizerPresets.find(safeName);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
cAudioMap<cAudioString, sEqualizerParameters>::Type::iterator it = EqualizerPresets.find(safeName);
|
||||
if(it != EqualizerPresets.end())
|
||||
{
|
||||
return it->second;
|
||||
|
@ -329,7 +329,7 @@ sEqualizerParameters cAudioEffects::getEqualizerEffectPreset(const char* name)
|
|||
void cAudioEffects::removeEffectPreset(const EffectTypes& type, const char* name)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
switch(type)
|
||||
{
|
||||
case EET_EAX_REVERB:
|
||||
|
@ -379,7 +379,7 @@ void cAudioEffects::removeEffectPreset(const EffectTypes& type, const char* name
|
|||
bool cAudioEffects::isEffectPresetRegistered(const EffectTypes& type, const char* name)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
switch(type)
|
||||
{
|
||||
case EET_EAX_REVERB:
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "../include/cAudioPlatform.h"
|
||||
#include "../Headers/cFileSourceFactory.h"
|
||||
|
||||
#include <set>
|
||||
#include <string.h>
|
||||
#include <algorithm>
|
||||
|
||||
|
@ -54,14 +53,14 @@ namespace cAudio
|
|||
//Note: OpenAL is threadsafe, so a mutex only needs to protect the class state
|
||||
#ifdef CAUDIO_USE_INTERNAL_THREAD
|
||||
static cAudioMutex AudioManagerObjectsMutex;
|
||||
static std::set<IAudioManager*, std::less<IAudioManager*>, cSTLAllocator<IAudioManager*> > AudioManagerObjects;
|
||||
static cAudioSet<IAudioManager*>::Type AudioManagerObjects;
|
||||
|
||||
CAUDIO_DECLARE_THREAD_FUNCTION(AudioManagerUpdateThread)
|
||||
{
|
||||
while(RunAudioManagerThread)
|
||||
{
|
||||
AudioManagerObjectsMutex.lock();
|
||||
std::set<IAudioManager*, std::less<IAudioManager*>, cSTLAllocator<IAudioManager*> >::iterator it;
|
||||
cAudioSet<IAudioManager*>::Type::iterator it;
|
||||
for ( it=AudioManagerObjects.begin() ; it != AudioManagerObjects.end(); it++ )
|
||||
{
|
||||
(*it)->update();
|
||||
|
@ -163,10 +162,10 @@ namespace cAudio
|
|||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
|
||||
std::string audioName = safeCStr(name);
|
||||
std::string path = safeCStr(filename);
|
||||
cAudioString audioName = safeCStr(name);
|
||||
cAudioString path = safeCStr(filename);
|
||||
|
||||
std::string ext = getExt(path);
|
||||
cAudioString ext = getExt(path);
|
||||
IAudioDecoderFactory* factory = getAudioDecoderFactory(ext.c_str());
|
||||
|
||||
if(factory)
|
||||
|
@ -224,8 +223,8 @@ namespace cAudio
|
|||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
|
||||
std::string audioName = safeCStr(name);
|
||||
std::string ext = safeCStr(extension);
|
||||
cAudioString audioName = safeCStr(name);
|
||||
cAudioString ext = safeCStr(extension);
|
||||
IAudioDecoderFactory* factory = getAudioDecoderFactory(ext.c_str());
|
||||
if(factory)
|
||||
{
|
||||
|
@ -289,7 +288,7 @@ namespace cAudio
|
|||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
|
||||
std::string audioName = safeCStr(name);
|
||||
cAudioString audioName = safeCStr(name);
|
||||
IAudioDecoderFactory* factory = getAudioDecoderFactory("raw");
|
||||
if(factory)
|
||||
{
|
||||
|
@ -352,7 +351,7 @@ namespace cAudio
|
|||
bool cAudioManager::registerAudioDecoder(IAudioDecoderFactory* factory, const char* extension)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string ext = safeCStr(extension);
|
||||
cAudioString ext = safeCStr(extension);
|
||||
decodermap[ext] = factory;
|
||||
getLogger()->logInfo("AudioManager", "Audio Decoder for extension .%s registered.", ext.c_str());
|
||||
return true;
|
||||
|
@ -361,7 +360,7 @@ namespace cAudio
|
|||
void cAudioManager::unRegisterAudioDecoder(const char* extension)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string ext = safeCStr(extension);
|
||||
cAudioString ext = safeCStr(extension);
|
||||
decodermapIterator it = decodermap.find(ext);
|
||||
if(it != decodermap.end())
|
||||
{
|
||||
|
@ -373,7 +372,7 @@ namespace cAudio
|
|||
bool cAudioManager::isAudioDecoderRegistered(const char* extension)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string ext = safeCStr(extension);
|
||||
cAudioString ext = safeCStr(extension);
|
||||
decodermapIterator it = decodermap.find(ext);
|
||||
return (it != decodermap.end());
|
||||
}
|
||||
|
@ -381,7 +380,7 @@ namespace cAudio
|
|||
IAudioDecoderFactory* cAudioManager::getAudioDecoderFactory(const char* extension)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string ext = safeCStr(extension);
|
||||
cAudioString ext = safeCStr(extension);
|
||||
decodermapIterator it = decodermap.find(ext);
|
||||
if(it != decodermap.end())
|
||||
{
|
||||
|
@ -396,7 +395,7 @@ namespace cAudio
|
|||
decodermap.clear();
|
||||
}
|
||||
|
||||
bool compareDataSourcePriorities(std::pair<int, std::string> left, std::pair<int, std::string> right)
|
||||
bool compareDataSourcePriorities(std::pair<int, cAudioString> left, std::pair<int, cAudioString> right)
|
||||
{
|
||||
return (left.first > right.first);
|
||||
}
|
||||
|
@ -404,9 +403,9 @@ namespace cAudio
|
|||
bool cAudioManager::registerDataSource(IDataSourceFactory* factory, const char* name, int priority)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
datasourcemap[safeName] = factory;
|
||||
dataSourcePriorityList.push_back(std::pair<int, std::string>(priority, safeName));
|
||||
dataSourcePriorityList.push_back(std::pair<int, cAudioString>(priority, safeName));
|
||||
std::sort(dataSourcePriorityList.begin(), dataSourcePriorityList.end(), compareDataSourcePriorities);
|
||||
|
||||
getLogger()->logInfo("AudioManager", "Data Source named %s registered (Priority %i).", safeName.c_str(), priority);
|
||||
|
@ -416,7 +415,7 @@ namespace cAudio
|
|||
void cAudioManager::unRegisterDataSource(const char* name)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
datasourcemapIterator it = datasourcemap.find(safeName);
|
||||
if(it != datasourcemap.end())
|
||||
{
|
||||
|
@ -439,7 +438,7 @@ namespace cAudio
|
|||
bool cAudioManager::isDataSourceRegistered(const char* name)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
datasourcemapIterator it = datasourcemap.find(safeName);
|
||||
return (it != datasourcemap.end());
|
||||
}
|
||||
|
@ -447,7 +446,7 @@ namespace cAudio
|
|||
IDataSourceFactory* cAudioManager::getDataSourceFactory(const char* name)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string safeName = safeCStr(name);
|
||||
cAudioString safeName = safeCStr(name);
|
||||
datasourcemapIterator it = datasourcemap.find(safeName);
|
||||
if(it != datasourcemap.end())
|
||||
{
|
||||
|
@ -487,7 +486,7 @@ namespace cAudio
|
|||
void cAudioManager::signalEvent(Events sevent)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::list<IManagerEventHandler*, cSTLAllocator<IManagerEventHandler*> >::iterator it = eventHandlerList.begin();
|
||||
cAudioList<IManagerEventHandler*>::Type::iterator it = eventHandlerList.begin();
|
||||
|
||||
if(it != eventHandlerList.end())
|
||||
{
|
||||
|
@ -553,7 +552,7 @@ namespace cAudio
|
|||
IAudioSource* cAudioManager::getSoundByName(const char* name)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::string audioName = safeCStr(name);
|
||||
cAudioString audioName = safeCStr(name);
|
||||
audioIndexIterator i = audioIndex.find(audioName);
|
||||
if (i == audioIndex.end())
|
||||
{
|
||||
|
@ -672,7 +671,7 @@ namespace cAudio
|
|||
{
|
||||
while(*deviceList)
|
||||
{
|
||||
std::string device(deviceList);
|
||||
cAudioString device(deviceList);
|
||||
AvailableDevices.push_back(device);
|
||||
deviceList += strlen(deviceList) + 1;
|
||||
}
|
||||
|
@ -688,7 +687,7 @@ namespace cAudio
|
|||
{
|
||||
while(*deviceList)
|
||||
{
|
||||
std::string device(deviceList);
|
||||
cAudioString device(deviceList);
|
||||
AvailableDevices.push_back(device);
|
||||
deviceList += strlen(deviceList) + 1;
|
||||
}
|
||||
|
@ -748,7 +747,7 @@ namespace cAudio
|
|||
#endif
|
||||
|
||||
#ifdef CAUDIO_COMPILE_WITH_PLUGIN_SUPPORT
|
||||
std::vector<IAudioPlugin*> plugins = cPluginManager::Instance()->getPluginList();
|
||||
cAudioVector<IAudioPlugin*>::Type plugins = cPluginManager::Instance()->getPluginList();
|
||||
for(unsigned int i = 0; i < plugins.size(); ++i)
|
||||
{
|
||||
plugins[i]->onCreateAudioManager(manager);
|
||||
|
@ -783,7 +782,7 @@ namespace cAudio
|
|||
#endif
|
||||
|
||||
#ifdef CAUDIO_COMPILE_WITH_PLUGIN_SUPPORT
|
||||
std::vector<IAudioPlugin*> plugins = cPluginManager::Instance()->getPluginList();
|
||||
cAudioVector<IAudioPlugin*>::Type plugins = cPluginManager::Instance()->getPluginList();
|
||||
for(unsigned int i = 0; i < plugins.size(); ++i)
|
||||
{
|
||||
plugins[i]->onDestroyAudioManager(manager);
|
||||
|
|
|
@ -792,7 +792,7 @@ namespace cAudio
|
|||
void cAudioSource::signalEvent(Events sevent)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
std::list<ISourceEventHandler*, cSTLAllocator<ISourceEventHandler*> >::iterator it = eventHandlerList.begin();
|
||||
cAudioList<ISourceEventHandler*>::Type::iterator it = eventHandlerList.begin();
|
||||
|
||||
if(it != eventHandlerList.end()){
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace cAudio
|
|||
|
||||
cFileSource::cFileSource(const char* filename) : pFile(NULL), Valid(false), Filesize(0)
|
||||
{
|
||||
std::string safeFilename = safeCStr(filename);
|
||||
cAudioString safeFilename = safeCStr(filename);
|
||||
if(safeFilename.length() != 0)
|
||||
{
|
||||
pFile = fopen(safeFilename.c_str(),"rb");
|
||||
|
|
|
@ -106,7 +106,7 @@ namespace cAudio
|
|||
bool cLogger::registerLogReceiver(ILogReceiver* receiver, const char* name)
|
||||
{
|
||||
Mutex.lock();
|
||||
std::string logName = safeCStr(name);
|
||||
cAudioString logName = safeCStr(name);
|
||||
Receivers[logName] = receiver;
|
||||
Mutex.unlock();
|
||||
return true;
|
||||
|
@ -115,7 +115,7 @@ namespace cAudio
|
|||
void cLogger::unRegisterLogReceiver(const char* name)
|
||||
{
|
||||
Mutex.lock();
|
||||
std::string logName = safeCStr(name);
|
||||
cAudioString logName = safeCStr(name);
|
||||
ReceiversIterator it = Receivers.find(logName);
|
||||
if(it != Receivers.end())
|
||||
{
|
||||
|
@ -127,7 +127,7 @@ namespace cAudio
|
|||
bool cLogger::isLogReceiverRegistered(const char* name)
|
||||
{
|
||||
Mutex.lock();
|
||||
std::string logName = safeCStr(name);
|
||||
cAudioString logName = safeCStr(name);
|
||||
ReceiversIterator it = Receivers.find(logName);
|
||||
bool result = (it != Receivers.end());
|
||||
Mutex.unlock();
|
||||
|
@ -137,7 +137,7 @@ namespace cAudio
|
|||
ILogReceiver* cLogger::getLogReceiver(const char* name)
|
||||
{
|
||||
Mutex.lock();
|
||||
std::string logName = safeCStr(name);
|
||||
cAudioString logName = safeCStr(name);
|
||||
ReceiversIterator it = Receivers.find(logName);
|
||||
if(it != Receivers.end())
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ bool cPluginManager::installPlugin(IAudioPlugin* plugin, const char* name)
|
|||
{
|
||||
if(plugin)
|
||||
{
|
||||
std::string theName = safeCStr(name);
|
||||
cAudioString theName = safeCStr(name);
|
||||
if(theName.empty())
|
||||
theName = plugin->getPluginName();
|
||||
|
||||
|
@ -96,9 +96,9 @@ unsigned int cPluginManager::getPluginCount()
|
|||
return RegisteredPlugins.size();
|
||||
}
|
||||
|
||||
std::vector<IAudioPlugin*> cPluginManager::getPluginList()
|
||||
cAudioVector<IAudioPlugin*>::Type cPluginManager::getPluginList()
|
||||
{
|
||||
std::vector<IAudioPlugin*> list;
|
||||
cAudioVector<IAudioPlugin*>::Type list;
|
||||
RegisteredPluginsIterator it;
|
||||
for(it = RegisteredPlugins.begin(); it != RegisteredPlugins.end(); it++)
|
||||
{
|
||||
|
@ -148,7 +148,7 @@ void cPluginManager::uninstallPlugin(const char* name)
|
|||
#ifdef CAUDIO_COMPILE_WITH_DYNAMIC_PLUGIN_SUPPORT
|
||||
void cPluginManager::autoLoadPlugins()
|
||||
{
|
||||
std::vector<std::string> fileList = getFilesInDirectory(".");
|
||||
cAudioVector<cAudioString>::Type fileList = getFilesInDirectory(".");
|
||||
for(int i=0; i<fileList.size(); ++i)
|
||||
{
|
||||
if(fileList[i].substr(0, 4) == "cAp_")
|
||||
|
@ -164,7 +164,7 @@ void cPluginManager::autoLoadPlugins()
|
|||
#endif
|
||||
{
|
||||
//Found a plugin, load it
|
||||
installPlugin(std::string("./" + fileList[i]).c_str(), NULL);
|
||||
installPlugin(cAudioString("./" + fileList[i]).c_str(), NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,6 +65,9 @@
|
|||
//! Tells cAudio to use the C standard memory functions for allocations (memalloc and free)
|
||||
#define CAUDIO_MEMORY_USE_STD
|
||||
|
||||
//! Tells cAudio to reroute memory allocations from stl containers into the defined memory provider for cAudio, otherwise the standard std::allocator is used.
|
||||
#define CAUDIO_REROUTE_STL_ALLOCATIONS
|
||||
|
||||
//! Activates the internal memory tracker, which can be used to detect and locate memory leaks.
|
||||
//#define CAUDIO_USE_MEMORYTRACKER
|
||||
|
||||
|
@ -121,6 +124,9 @@
|
|||
//! Tells cAudio to use the C standard memory functions for allocations (memalloc and free)
|
||||
#define CAUDIO_MEMORY_USE_STD
|
||||
|
||||
//! Tells cAudio to reroute memory allocations from stl containers into the defined memory provider for cAudio, otherwise the standard std::allocator is used.
|
||||
#define CAUDIO_REROUTE_STL_ALLOCATIONS
|
||||
|
||||
//! Activates the internal memory tracker, which can be used to detect and locate memory leaks.
|
||||
//#define CAUDIO_USE_MEMORYTRACKER
|
||||
|
||||
|
@ -166,6 +172,9 @@
|
|||
//! Tells cAudio to use the C standard memory functions for allocations (memalloc and free)
|
||||
#define CAUDIO_MEMORY_USE_STD
|
||||
|
||||
//! Tells cAudio to reroute memory allocations from stl containers into the defined memory provider for cAudio, otherwise the standard std::allocator is used.
|
||||
#define CAUDIO_REROUTE_STL_ALLOCATIONS
|
||||
|
||||
//! Activates the internal memory tracker, which can be used to detect and locate memory leaks.
|
||||
//#define CAUDIO_USE_MEMORYTRACKER
|
||||
|
||||
|
@ -225,6 +234,9 @@
|
|||
//! Tells cAudio to use the C standard memory functions for allocations (memalloc and free)
|
||||
#define CAUDIO_MEMORY_USE_STD
|
||||
|
||||
//! Tells cAudio to reroute memory allocations from stl containers into the defined memory provider for cAudio, otherwise the standard std::allocator is used.
|
||||
#define CAUDIO_REROUTE_STL_ALLOCATIONS
|
||||
|
||||
//! Activates the internal memory tracker, which can be used to detect and locate memory leaks.
|
||||
//#define CAUDIO_USE_MEMORYTRACKER
|
||||
|
||||
|
|
|
@ -4,6 +4,18 @@
|
|||
#include "cAudioDefines.h"
|
||||
#include "IMemoryProvider.h"
|
||||
|
||||
#ifdef CAUDIO_DEBUG
|
||||
#define CAUDIO_NEW new (__FILE__, __LINE__, __FUNCTION__)
|
||||
#define CAUDIO_DELETE delete
|
||||
#define CAUDIO_MALLOC(size) cAudio::getMemoryProvider()->Allocate(size, __FILE__, __LINE__, __FUNCTION__)
|
||||
#define CAUDIO_FREE(pointer) cAudio::getMemoryProvider()->Free((void*)pointer)
|
||||
#else
|
||||
#define CAUDIO_NEW new
|
||||
#define CAUDIO_DELETE delete
|
||||
#define CAUDIO_MALLOC(size) cAudio::getMemoryProvider()->Allocate(size, NULL, -1, NULL)
|
||||
#define CAUDIO_FREE(pointer) cAudio::getMemoryProvider()->Free((void*)pointer)
|
||||
#endif
|
||||
|
||||
namespace cAudio
|
||||
{
|
||||
CAUDIO_API IMemoryProvider* getMemoryProvider();
|
||||
|
|
|
@ -23,4 +23,20 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef CAUDIO_COMPILIER_GCC
|
||||
# if defined(__GNUC__) || defined(__GCCXML__)
|
||||
# define CAUDIO_COMPILIER_GCC
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef CAUDIO_COMPILIER_MSVC
|
||||
# if defined(_MSC_VER)
|
||||
# if _MSC_VER >= 1400
|
||||
# define CAUDIO_COMPILIER_MSVC
|
||||
# else
|
||||
# error This version of the MSVC compilier is not supported
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif //! CAUDIOPLATFORM_H_INCLUDED
|
Loading…
Reference in New Issue