Changes to make sure undefining decoders and EFX actually removes all pieces of them.
This commit is contained in:
parent
8a42fbb6e5
commit
16f222c8a5
|
@ -42,6 +42,7 @@ int main(int argc, char* argv[])
|
|||
//Initialize the manager with the user settings
|
||||
manager->initialize(manager->getAvailableDeviceName(deviceSelection));
|
||||
|
||||
#ifdef CAUDIO_EFX_ENABLED
|
||||
cAudio::IAudioEffects* effects = manager->getEffects();
|
||||
if(effects)
|
||||
{
|
||||
|
@ -341,6 +342,7 @@ int main(int argc, char* argv[])
|
|||
effect->drop();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//Delete all IAudio sounds
|
||||
manager->release();
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#include "../Headers/cMutex.h"
|
||||
#include "../Headers/cEFXFunctions.h"
|
||||
|
||||
#ifdef CAUDIO_EFX_ENABLED
|
||||
|
||||
namespace cAudio
|
||||
{
|
||||
class cAudioEffects : public IAudioEffects
|
||||
|
@ -36,4 +38,6 @@ namespace cAudio
|
|||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif //! CAUDIOEFFECTS_H
|
|
@ -84,7 +84,10 @@ namespace cAudio
|
|||
void getAvailableDevices();
|
||||
|
||||
virtual IListener* getListener() { return &initlistener; }
|
||||
|
||||
#ifdef CAUDIO_EFX_ENABLED
|
||||
virtual IAudioEffects* getEffects() { return &initEffects; }
|
||||
#endif
|
||||
|
||||
private:
|
||||
//Mutex for thread syncronization
|
||||
|
@ -112,8 +115,10 @@ namespace cAudio
|
|||
|
||||
//! The listener object
|
||||
cListener initlistener;
|
||||
#ifdef CAUDIO_EFX_ENABLED
|
||||
//! Interface for audio effects
|
||||
cAudioEffects initEffects;
|
||||
#endif
|
||||
//! Check for OpenAL errors
|
||||
bool checkError();
|
||||
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
#ifndef CEFXFUNCTIONS_H
|
||||
#define CEFXFUNCTIONS_H
|
||||
|
||||
#include "../include/cAudioDefines.h"
|
||||
|
||||
#ifdef CAUDIO_EFX_ENABLED
|
||||
|
||||
#include <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
#include <AL/efx.h>
|
||||
|
@ -184,4 +188,6 @@ namespace cAudio
|
|||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif //! CEFXFUNCTIONS_H
|
|
@ -9,6 +9,8 @@
|
|||
#include "../Headers/cMutex.h"
|
||||
#include "../Headers/cEFXFunctions.h"
|
||||
|
||||
#ifdef CAUDIO_EFX_ENABLED
|
||||
|
||||
#include <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
|
||||
|
@ -118,4 +120,7 @@ namespace cAudio
|
|||
};
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif //! CEFFECT_H
|
|
@ -9,6 +9,8 @@
|
|||
#include "../Headers/cMutex.h"
|
||||
#include "../Headers/cEFXFunctions.h"
|
||||
|
||||
#ifdef CAUDIO_EFX_ENABLED
|
||||
|
||||
#include <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
|
||||
|
@ -59,4 +61,6 @@ namespace cAudio
|
|||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif //! CFILTER_H
|
|
@ -9,6 +9,8 @@
|
|||
#include "cOggDecoder.h"
|
||||
#include "../Headers/cMutex.h"
|
||||
|
||||
#ifdef CAUDIO_COMPILE_WITH_OGG_DECODER
|
||||
|
||||
namespace cAudio
|
||||
{
|
||||
|
||||
|
@ -33,4 +35,6 @@ class cOggAudioDecoderFactory : public IAudioDecoderFactory
|
|||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif //! COGGAUDIODECODERFACTORY_H
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
#ifndef COGGDECODER_H_INCLUDED
|
||||
#define COGGDECODER_H_INCLUDED
|
||||
|
||||
#include "../include/cAudioDefines.h"
|
||||
|
||||
#ifdef CAUDIO_COMPILE_WITH_OGG_DECODER
|
||||
|
||||
#include "../include/IAudioDecoder.h"
|
||||
#include <ogg/ogg.h>
|
||||
#include <vorbis/codec.h>
|
||||
|
@ -56,4 +60,6 @@ namespace cAudio
|
|||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif //! COGGDECODER_H_INCLUDED
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#include "cWavDecoder.h"
|
||||
#include "../Headers/cMutex.h"
|
||||
|
||||
#ifdef CAUDIO_COMPILE_WITH_WAV_DECODER
|
||||
|
||||
namespace cAudio
|
||||
{
|
||||
|
||||
|
@ -32,4 +34,6 @@ class cWavAudioDecoderFactory : public IAudioDecoderFactory
|
|||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif //! CWAVAUDIODECODERFACOTRY_H_INCLUDED
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
#define CWAVDECODER_H_INCLUDED
|
||||
|
||||
#include "../include/IAudioDecoder.h"
|
||||
#include "../include/cAudioDefines.h"
|
||||
|
||||
#ifdef CAUDIO_COMPILE_WITH_WAV_DECODER
|
||||
|
||||
namespace cAudio
|
||||
{
|
||||
|
@ -50,7 +53,9 @@ namespace cAudio
|
|||
bool Valid;
|
||||
};
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif //! CFLACDECODER_H_INCLUDED
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include "../Headers/cFilter.h"
|
||||
#include "../Headers/cEffect.h"
|
||||
|
||||
#ifdef CAUDIO_EFX_ENABLED
|
||||
|
||||
//Number of effect slots to try to create
|
||||
#define EFFECT_SLOTS_TO_TEST 256
|
||||
|
||||
|
@ -167,4 +169,6 @@ void cAudioEffects::checkEFXSupportDetails()
|
|||
}
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
|
@ -18,6 +18,8 @@
|
|||
#include <set>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef CAUDIO_EFX_ENABLED
|
||||
|
||||
#ifdef CAUDIO_PLATFORM_WIN
|
||||
#include <AL/efx.h>
|
||||
#include <AL/efx-creative.h>
|
||||
|
@ -28,6 +30,8 @@
|
|||
#include <AL/alext.h>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#define LOAD_AL_FUNC(x) (x = (typeof(x))alGetProcAddress(#x))
|
||||
|
||||
namespace cAudio
|
||||
|
@ -40,9 +44,8 @@ namespace cAudio
|
|||
#ifdef CAUDIO_COMPILE_WITH_WAV_DECODER
|
||||
static cWavAudioDecoderFactory WavDecoderFactory;
|
||||
#endif
|
||||
#ifdef CAUDIO_COMPILE_WITH_RAW_DECODER
|
||||
|
||||
static cRawAudioDecoderFactory RawDecoderFactory;
|
||||
#endif
|
||||
|
||||
//Note: OpenAL is threadsafe, so a mutex only needs to protect the class state
|
||||
#ifdef CAUDIO_USE_INTERNAL_THREAD
|
||||
|
@ -83,11 +86,13 @@ namespace cAudio
|
|||
attribs[currentAttrib++] = ALC_FREQUENCY;
|
||||
attribs[currentAttrib++] = outputFrequency;
|
||||
}
|
||||
#ifdef CAUDIO_EFX_ENABLED
|
||||
if(eaxEffectSlots > 0)
|
||||
{
|
||||
attribs[currentAttrib++] = ALC_MAX_AUXILIARY_SENDS;
|
||||
attribs[currentAttrib++] = eaxEffectSlots;
|
||||
}
|
||||
#endif
|
||||
|
||||
//Create a new device
|
||||
Device = alcOpenDevice(deviceName);
|
||||
|
@ -186,7 +191,11 @@ namespace cAudio
|
|||
{
|
||||
if(decoder->isValid())
|
||||
{
|
||||
#ifdef CAUDIO_EFX_ENABLED
|
||||
IAudioSource* audio = new cAudioSource(decoder, Context, initEffects.getEFXInterface());
|
||||
#else
|
||||
IAudioSource* audio = new cAudioSource(decoder, Context);
|
||||
#endif
|
||||
decoder->drop();
|
||||
|
||||
if(audio)
|
||||
|
@ -278,7 +287,11 @@ namespace cAudio
|
|||
{
|
||||
if(decoder->isValid())
|
||||
{
|
||||
#ifdef CAUDIO_EFX_ENABLED
|
||||
IAudioSource* audio = new cAudioSource(decoder, Context, initEffects.getEFXInterface());
|
||||
#else
|
||||
IAudioSource* audio = new cAudioSource(decoder, Context);
|
||||
#endif
|
||||
decoder->drop();
|
||||
|
||||
if(audio)
|
||||
|
@ -338,7 +351,11 @@ namespace cAudio
|
|||
{
|
||||
if(decoder->isValid())
|
||||
{
|
||||
#ifdef CAUDIO_EFX_ENABLED
|
||||
IAudioSource* audio = new cAudioSource(decoder, Context, initEffects.getEFXInterface());
|
||||
#else
|
||||
IAudioSource* audio = new cAudioSource(decoder, Context);
|
||||
#endif
|
||||
decoder->drop();
|
||||
|
||||
if(audio)
|
||||
|
@ -399,7 +416,11 @@ namespace cAudio
|
|||
{
|
||||
if(decoder->isValid())
|
||||
{
|
||||
#ifdef CAUDIO_EFX_ENABLED
|
||||
IAudioSource* audio = new cAudioSource(decoder, Context, initEffects.getEFXInterface());
|
||||
#else
|
||||
IAudioSource* audio = new cAudioSource(decoder, Context);
|
||||
#endif
|
||||
decoder->drop();
|
||||
if(audio)
|
||||
{
|
||||
|
|
|
@ -86,8 +86,6 @@ namespace cAudio
|
|||
if (!isPaused())
|
||||
{
|
||||
int queueSize = 0;
|
||||
//Resets the audio to the beginning
|
||||
Decoder->setPosition(0, false);
|
||||
//Purges all buffers from the source
|
||||
alSourcei(Source, AL_BUFFER, 0);
|
||||
checkError();
|
||||
|
@ -151,6 +149,8 @@ namespace cAudio
|
|||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
alSourceStop(Source);
|
||||
//Resets the audio to the beginning
|
||||
Decoder->setPosition(0, false);
|
||||
checkError();
|
||||
getLogger()->logDebug("Audio Source", "Source stopped.");
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include "../Headers/cLogger.h"
|
||||
#include "../Headers/cUtils.h"
|
||||
|
||||
#ifdef CAUDIO_EFX_ENABLED
|
||||
|
||||
namespace cAudio
|
||||
{
|
||||
cEffect::cEffect(cEFXFunctions* oALFunctions) : EFX(oALFunctions), Type(EET_NULL),
|
||||
|
@ -698,4 +700,6 @@ namespace cAudio
|
|||
return AL_VOCAL_MORPHER_DEFAULT_PHONEMEA;
|
||||
};
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
|
@ -6,6 +6,8 @@
|
|||
#include "../Headers/cLogger.h"
|
||||
#include "../Headers/cUtils.h"
|
||||
|
||||
#ifdef CAUDIO_EFX_ENABLED
|
||||
|
||||
namespace cAudio
|
||||
{
|
||||
cFilter::cFilter(cEFXFunctions* oALFunctions) : EFX(oALFunctions), Type(EFT_NULL),
|
||||
|
@ -176,4 +178,6 @@ namespace cAudio
|
|||
return AL_FILTER_NULL;
|
||||
};
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
|
@ -3,6 +3,9 @@
|
|||
// For conditions of distribution and use, see copyright notice in cAudio.h
|
||||
|
||||
#include "../Headers/cOggDecoder.h"
|
||||
|
||||
#ifdef CAUDIO_COMPILE_WITH_OGG_DECODER
|
||||
|
||||
namespace cAudio
|
||||
{
|
||||
//!Read Vorbis Data
|
||||
|
@ -143,4 +146,6 @@ namespace cAudio
|
|||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#include "../Headers/cWavDecoder.h"
|
||||
#include <string.h>
|
||||
|
||||
#ifdef CAUDIO_COMPILE_WITH_WAV_DECODER
|
||||
|
||||
namespace cAudio
|
||||
{
|
||||
cWavDecoder::cWavDecoder(IDataSource* stream) : IAudioDecoder(stream), Valid(false)
|
||||
|
@ -201,6 +203,8 @@ namespace cAudio
|
|||
}
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
4
ToDo.txt
4
ToDo.txt
|
@ -1,8 +1,8 @@
|
|||
Make sure #undef CAUDIO_EFX_ENABLED works properly
|
||||
Effect Presets
|
||||
File log reciever
|
||||
File source caching
|
||||
Possible rework of custom IDataSource to make it transparent with normal filesystem loading
|
||||
Final quality check
|
||||
Final documentation pass
|
||||
Demonstate via tutorial adding a log reciever, event handler, and custom plugin
|
||||
Demonstate via tutorial adding a log reciever, event handler, and custom plugin
|
||||
Change all tutorials to say cAudio 2.0.0
|
|
@ -9,6 +9,8 @@
|
|||
#include "IFilter.h"
|
||||
#include "cAudioDefines.h"
|
||||
|
||||
#ifdef CAUDIO_EFX_ENABLED
|
||||
|
||||
namespace cAudio
|
||||
{
|
||||
class IAudioEffects
|
||||
|
@ -43,4 +45,6 @@ namespace cAudio
|
|||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif //! IAUDIOEFFECTS_H
|
|
@ -73,7 +73,10 @@ namespace cAudio
|
|||
|
||||
//!Returns an interface for the listener
|
||||
virtual IListener* getListener() = 0;
|
||||
|
||||
#ifdef CAUDIO_EFX_ENABLED
|
||||
virtual IAudioEffects* getEffects() = 0;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
private:
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
#include "IRefCounted.h"
|
||||
#include "IFilter.h"
|
||||
#include "IEffectParameters.h"
|
||||
#include "cAudioDefines.h"
|
||||
|
||||
#ifdef CAUDIO_EFX_ENABLED
|
||||
|
||||
namespace cAudio
|
||||
{
|
||||
|
@ -93,4 +96,6 @@ namespace cAudio
|
|||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif //! IEFFECT_H
|
|
@ -6,6 +6,9 @@
|
|||
#define IEFFECTPARAMETERS_H
|
||||
|
||||
#include "cVector3.h"
|
||||
#include "cAudioDefines.h"
|
||||
|
||||
#ifdef CAUDIO_EFX_ENABLED
|
||||
|
||||
namespace cAudio
|
||||
{
|
||||
|
@ -365,4 +368,6 @@ namespace cAudio
|
|||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif //! IEFFECTPARAMETERS_H
|
|
@ -6,6 +6,9 @@
|
|||
#define IFILTER_H
|
||||
|
||||
#include "IRefCounted.h"
|
||||
#include "cAudioDefines.h"
|
||||
|
||||
#ifdef CAUDIO_EFX_ENABLED
|
||||
|
||||
namespace cAudio
|
||||
{
|
||||
|
@ -41,4 +44,6 @@ namespace cAudio
|
|||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif //! IFILTER_H
|
|
@ -27,6 +27,7 @@
|
|||
#define CAUDIO_H
|
||||
|
||||
#include "cAudioDefines.h"
|
||||
#include "cAudioPlatform.h"
|
||||
#include "cAudioSleep.h"
|
||||
#include "EAudioFormats.h"
|
||||
#include "IAudioSource.h"
|
||||
|
@ -42,6 +43,7 @@
|
|||
#include "IListener.h"
|
||||
#include "ILogger.h"
|
||||
#include "ILogReceiver.h"
|
||||
#include "IPluginManager.h"
|
||||
#include "IRefCounted.h"
|
||||
|
||||
#endif
|
|
@ -35,7 +35,6 @@
|
|||
//These defines control which of the default audio codecs are compiled into the library
|
||||
#define CAUDIO_COMPILE_WITH_OGG_DECODER
|
||||
#define CAUDIO_COMPILE_WITH_WAV_DECODER
|
||||
#define CAUDIO_COMPILE_WITH_RAW_DECODER
|
||||
|
||||
////////////////////////
|
||||
//Audio Source Settings
|
||||
|
|
|
@ -10,15 +10,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
//Include IAudioManager so we can easily work with cAudio
|
||||
#include "../../include/IAudioManager.h"
|
||||
//Include IAudio so we can create cAudio objects
|
||||
#include "../../include/IAudioSource.h"
|
||||
//Include The cAudio vector class
|
||||
#include "../../include/cVector3.h"
|
||||
//Include our version of Sleep to free CPU usage
|
||||
#include "../../include/cAudioSleep.h"
|
||||
//Include the logger interface
|
||||
#include "../../include/ILogger.h"
|
||||
#include "../../include/cAudio.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
|
Loading…
Reference in New Issue