48d264d0be
Fixed a bug that prevented cAudio from getting plugin symbols correctly. Fixed a bug where cPluginManager would be constructed multiple times.
47 lines
1.3 KiB
C++
47 lines
1.3 KiB
C++
#include "cMP3DecoderFactory.h"
|
|
#include "IAudioPlugin.h"
|
|
#include "cAudioDefines.h"
|
|
#include "IAudioManager.h"
|
|
#include "ILogger.h"
|
|
|
|
//Will be called on initial install of the plugin, use this for any first time initialization.
|
|
extern "C" CAUDIO_API bool InstallPlugin(cAudio::ILogger* logger)
|
|
{
|
|
//This plugin has no first time initialization to do, so this is an easy function
|
|
return true;
|
|
}
|
|
|
|
//Must return a unique name that identifies this plugin.
|
|
extern "C" CAUDIO_API const char* GetPluginName()
|
|
{
|
|
return "MP3Decoder";
|
|
}
|
|
|
|
//Will be called on when cAudio uninstalls this plugin, use this for any final cleanup.
|
|
extern "C" CAUDIO_API void UninstallPlugin()
|
|
{
|
|
|
|
}
|
|
|
|
//Will be called when an Audio Manager is created. Use the passed in pointer to register any decoders or event handlers.
|
|
extern "C" CAUDIO_API void OnCreateAudioManager(cAudio::IAudioManager* manager)
|
|
{
|
|
cMP3DecoderFactory* factory = new cMP3DecoderFactory();
|
|
|
|
if(factory)
|
|
{
|
|
manager->registerAudioDecoder(factory, "mp3");
|
|
}
|
|
}
|
|
|
|
extern "C" CAUDIO_API void OnDestroyAudioManager(cAudio::IAudioManager* manager)
|
|
{
|
|
cAudio::IAudioDecoderFactory* factory = manager->getAudioDecoderFactory("mp3");
|
|
manager->unRegisterAudioDecoder("mp3");
|
|
|
|
if(factory)
|
|
{
|
|
delete factory;
|
|
}
|
|
}
|