Added additional defines for more control of which components are compiled into the library (for embedded platforms like the IPhone).

This commit is contained in:
Joshua Jones 2010-03-05 01:52:25 +00:00
parent 199b10fe0d
commit 1e2fe1c54c
12 changed files with 73 additions and 7 deletions

View File

@ -6,7 +6,9 @@
#define CCONSOLELOGRECEIVER_H_INCLUDED #define CCONSOLELOGRECEIVER_H_INCLUDED
#include "../include/ILogReceiver.h" #include "../include/ILogReceiver.h"
#include "../include/cAudioDefines.h"
#ifdef CAUDIO_COMPILE_WITH_CONSOLE_LOG_RECEIVER
namespace cAudio namespace cAudio
{ {
@ -17,6 +19,7 @@ namespace cAudio
}; };
}; };
#endif
#endif //! CCONSOLELOGRECEIVER_H_INCLUDED #endif //! CCONSOLELOGRECEIVER_H_INCLUDED

View File

@ -6,7 +6,9 @@
#define CFILELOGERCEIVER_H_INCLUDED #define CFILELOGERCEIVER_H_INCLUDED
#include "../include/ILogReceiver.h" #include "../include/ILogReceiver.h"
#include "../include/cAudioDefines.h"
#ifdef CAUDIO_COMPILE_WITH_FILE_LOG_RECEIVER
namespace cAudio namespace cAudio
{ {
@ -24,5 +26,6 @@ namespace cAudio
}; };
}; };
#endif
#endif //!CFILELOGRECEIVER_H_INCLUDED #endif //!CFILELOGRECEIVER_H_INCLUDED

View File

@ -6,8 +6,10 @@
#define CFILESOURCE_H #define CFILESOURCE_H
#include "../include/IDataSource.h" #include "../include/IDataSource.h"
#include <string> #include "../include/cAudioDefines.h"
#include <iostream>
#ifdef CAUDIO_COMPILE_WITH_FILE_SOURCE
#include <fstream> #include <fstream>
namespace cAudio namespace cAudio
@ -37,4 +39,6 @@ class cFileSource : public IDataSource
}; };
#endif
#endif //! CFILESOURCE_H #endif //! CFILESOURCE_H

View File

@ -6,6 +6,9 @@
#define CFILESOURCEFACTORY_H #define CFILESOURCEFACTORY_H
#include "../include/IDataSourceFactory.h" #include "../include/IDataSourceFactory.h"
#ifdef CAUDIO_COMPILE_WITH_FILE_SOURCE
#include "../Headers/cFileSource.h" #include "../Headers/cFileSource.h"
#include "../Headers/cMemorySource.h" #include "../Headers/cMemorySource.h"
#include "../Headers/cMutex.h" #include "../Headers/cMutex.h"
@ -52,4 +55,6 @@ namespace cAudio
}; };
}; };
#endif
#endif //! CFILESOURCEFACTORY_H #endif //! CFILESOURCEFACTORY_H

View File

@ -12,7 +12,6 @@
#include "../include/IAudioDecoder.h" #include "../include/IAudioDecoder.h"
#include <ogg/ogg.h> #include <ogg/ogg.h>
#include <vorbis/codec.h> #include <vorbis/codec.h>
#include <vorbis/vorbisenc.h>
#include <vorbis/vorbisfile.h> #include <vorbis/vorbisfile.h>
namespace cAudio namespace cAudio

View File

@ -47,7 +47,9 @@ namespace cAudio
static cRawAudioDecoderFactory RawDecoderFactory; static cRawAudioDecoderFactory RawDecoderFactory;
#ifdef CAUDIO_COMPILE_WITH_FILE_SOURCE
static cFileSourceFactory FileSourceFactory; static cFileSourceFactory FileSourceFactory;
#endif
//Note: OpenAL is threadsafe, so a mutex only needs to protect the class state //Note: OpenAL is threadsafe, so a mutex only needs to protect the class state
#ifdef CAUDIO_USE_INTERNAL_THREAD #ifdef CAUDIO_USE_INTERNAL_THREAD
@ -741,7 +743,9 @@ namespace cAudio
manager->registerAudioDecoder(&RawDecoderFactory, "raw"); manager->registerAudioDecoder(&RawDecoderFactory, "raw");
#ifdef CAUDIO_COMPILE_WITH_FILE_SOURCE
manager->registerDataSource(&FileSourceFactory, "FileSystem", 0); manager->registerDataSource(&FileSourceFactory, "FileSystem", 0);
#endif
#ifdef CAUDIO_COMPILE_WITH_PLUGIN_SUPPORT #ifdef CAUDIO_COMPILE_WITH_PLUGIN_SUPPORT
std::vector<IAudioPlugin*> plugins = cPluginManager::Instance()->getPluginList(); std::vector<IAudioPlugin*> plugins = cPluginManager::Instance()->getPluginList();

View File

@ -3,6 +3,8 @@
// For conditions of distribution and use, see copyright notice in cAudio.h // For conditions of distribution and use, see copyright notice in cAudio.h
#include "../Headers/cConsoleLogReceiver.h" #include "../Headers/cConsoleLogReceiver.h"
#ifdef CAUDIO_COMPILE_WITH_CONSOLE_LOG_RECEIVER
#include <iostream> #include <iostream>
namespace cAudio namespace cAudio
@ -15,4 +17,6 @@ namespace cAudio
} }
}; };
#endif

View File

@ -3,6 +3,8 @@
// For conditions of distribution and use, see copyright notice in cAudio.h // For conditions of distribution and use, see copyright notice in cAudio.h
#include "../Headers/cFileLogReceiver.h" #include "../Headers/cFileLogReceiver.h"
#ifdef CAUDIO_COMPILE_WITH_FILE_LOG_RECEIVER
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
@ -161,4 +163,8 @@ namespace cAudio
} }
}; };
#endif

View File

@ -3,9 +3,12 @@
// For conditions of distribution and use, see copyright notice in cAudio.h // For conditions of distribution and use, see copyright notice in cAudio.h
#include "../Headers/cFileSource.h" #include "../Headers/cFileSource.h"
#include <cstring>
#include "../Headers/cUtils.h" #include "../Headers/cUtils.h"
#ifdef CAUDIO_COMPILE_WITH_FILE_SOURCE
#include <cstring>
namespace cAudio namespace cAudio
{ {
@ -75,3 +78,5 @@ bool cFileSource::seek(int amount, bool relative)
} }
}; };
#endif

View File

@ -12,8 +12,14 @@ namespace cAudio
{ {
static cLogger Logger; static cLogger Logger;
static bool FirstTimeLogInit(false); static bool FirstTimeLogInit(false);
#ifdef CAUDIO_COMPILE_WITH_CONSOLE_LOG_RECEIVER
static cConsoleLogReceiver ConsoleLog; static cConsoleLogReceiver ConsoleLog;
#endif
#ifdef CAUDIO_COMPILE_WITH_FILE_LOG_RECEIVER
static cFileLogReceiver FileLog; static cFileLogReceiver FileLog;
#endif
cLogger::cLogger() : StartTime(0), MinLogLevel(ELL_INFO) cLogger::cLogger() : StartTime(0), MinLogLevel(ELL_INFO)
{ {
@ -147,8 +153,12 @@ namespace cAudio
if(!FirstTimeLogInit) if(!FirstTimeLogInit)
{ {
FirstTimeLogInit = true; FirstTimeLogInit = true;
#ifdef CAUDIO_COMPILE_WITH_CONSOLE_LOG_RECEIVER
Logger.registerLogReceiver(&ConsoleLog, "Console"); Logger.registerLogReceiver(&ConsoleLog, "Console");
#endif
#ifdef CAUDIO_COMPILE_WITH_FILE_LOG_RECEIVER
Logger.registerLogReceiver(&FileLog,"File"); Logger.registerLogReceiver(&FileLog,"File");
#endif
} }
return &Logger; return &Logger;
} }

View File

@ -2,11 +2,10 @@
// This file is part of the "cAudio Engine" // This file is part of the "cAudio Engine"
// For conditions of distribution and use, see copyright notice in cAudio.h // For conditions of distribution and use, see copyright notice in cAudio.h
#include <cstring>
#include <iostream>
#include "../Headers/cMemorySource.h" #include "../Headers/cMemorySource.h"
#include <cstring>
namespace cAudio namespace cAudio
{ {

View File

@ -30,6 +30,12 @@
#define CAUDIO_COMPILE_WITH_OGG_DECODER #define CAUDIO_COMPILE_WITH_OGG_DECODER
//! This define controls whether the RIFF/Wav decoder is compiled into the library. //! This define controls whether the RIFF/Wav decoder is compiled into the library.
#define CAUDIO_COMPILE_WITH_WAV_DECODER #define CAUDIO_COMPILE_WITH_WAV_DECODER
//! This define controls whether the default filesystem data source is compiled into the library
#define CAUDIO_COMPILE_WITH_FILE_SOURCE
//! This define controls whether the default file logger (html) is compiled into the library
#define CAUDIO_COMPILE_WITH_FILE_LOG_RECEIVER
//! This define controls whether the default console logger is compiled into the library
#define CAUDIO_COMPILE_WITH_CONSOLE_LOG_RECEIVER
//! This define controls whether plugin support is added into the library, commenting it out will prevent any plugins from working //! 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 #define CAUDIO_COMPILE_WITH_PLUGIN_SUPPORT
@ -71,6 +77,12 @@
#define CAUDIO_COMPILE_WITH_OGG_DECODER #define CAUDIO_COMPILE_WITH_OGG_DECODER
//! This define controls whether the RIFF/Wav decoder is compiled into the library. //! This define controls whether the RIFF/Wav decoder is compiled into the library.
#define CAUDIO_COMPILE_WITH_WAV_DECODER #define CAUDIO_COMPILE_WITH_WAV_DECODER
//! This define controls whether the default filesystem data source is compiled into the library
#define CAUDIO_COMPILE_WITH_FILE_SOURCE
//! This define controls whether the default file logger (html) is compiled into the library
#define CAUDIO_COMPILE_WITH_FILE_LOG_RECEIVER
//! This define controls whether the default console logger is compiled into the library
#define CAUDIO_COMPILE_WITH_CONSOLE_LOG_RECEIVER
//! This define controls whether plugin support is added into the library, commenting it out will prevent any plugins from working //! 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 #define CAUDIO_COMPILE_WITH_PLUGIN_SUPPORT
@ -109,6 +121,12 @@
#define CAUDIO_COMPILE_WITH_OGG_DECODER #define CAUDIO_COMPILE_WITH_OGG_DECODER
//! This define controls whether the RIFF/Wav decoder is compiled into the library. //! This define controls whether the RIFF/Wav decoder is compiled into the library.
#define CAUDIO_COMPILE_WITH_WAV_DECODER #define CAUDIO_COMPILE_WITH_WAV_DECODER
//! This define controls whether the default filesystem data source is compiled into the library
#define CAUDIO_COMPILE_WITH_FILE_SOURCE
//! This define controls whether the default file logger (html) is compiled into the library
#define CAUDIO_COMPILE_WITH_FILE_LOG_RECEIVER
//! This define controls whether the default console logger is compiled into the library
#define CAUDIO_COMPILE_WITH_CONSOLE_LOG_RECEIVER
//! Size of the internal buffer per source for audio data (total amount buffered is CAUDIO_SOURCE_BUFFER_SIZE * CAUDIO_SOURCE_NUM_BUFFERS) //! 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 ) #define CAUDIO_SOURCE_BUFFER_SIZE ( 1024 * 64 )
@ -136,6 +154,12 @@
#define CAUDIO_COMPILE_WITH_OGG_DECODER #define CAUDIO_COMPILE_WITH_OGG_DECODER
//! This define controls whether the RIFF/Wav decoder is compiled into the library. //! This define controls whether the RIFF/Wav decoder is compiled into the library.
#define CAUDIO_COMPILE_WITH_WAV_DECODER #define CAUDIO_COMPILE_WITH_WAV_DECODER
//! This define controls whether the default filesystem data source is compiled into the library
#define CAUDIO_COMPILE_WITH_FILE_SOURCE
//! This define controls whether the default file logger (html) is compiled into the library
#define CAUDIO_COMPILE_WITH_FILE_LOG_RECEIVER
//! This define controls whether the default console logger is compiled into the library
#define CAUDIO_COMPILE_WITH_CONSOLE_LOG_RECEIVER
//! This define controls whether plugin support is added into the library, commenting it out will prevent any plugins from working //! 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 #define CAUDIO_COMPILE_WITH_PLUGIN_SUPPORT